40
loading...
This website collects cookies to deliver better user experience
const promise = new Promise()
const promise = new Promise((resolve, reject) => {
})
const promise = new Promise((resolve, reject) => {
//when the promise got fulfilled
resolve()
})
const promise = new Promise((resolve, reject) => {
//when the promise got rejected
reject()
})
const promise = new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, 1000)
)}
const promise = new Promise((resolve, reject) => {
setTimeout(() => {
reject()
}, 2000)
)}
promise.then()
promise.catch()
const onFulfillment = () => {
console.log("Promise is fulfilled")
}
const onRejected = () => {
console.log("Promise is not fulfilled")
}
promise.then(onFulfillment)
promise.catch(onRejected)
fetch(url)
.then(process)
.then(output)
.catch(handleErrors)
}