手撕Promise
原创小于 1 分钟
class MyPromise {
}
const promise1 = new MyPromise((resolve, reject) => {
setTimeout(() => {
resolve()
}, 3000)
})
promise1.then(rs => {
},()=>{}).catch(err => {})
class MyPromise {
}
const promise1 = new MyPromise((resolve, reject) => {
setTimeout(() => {
resolve()
}, 3000)
})
promise1.then(rs => {
},()=>{}).catch(err => {})