Open JingchaoZhao opened 5 years ago
new Promise((resolve, reject) => {console.log(1); resolve(2)}).then(result => console.log(result)).catch(err => console.log(err)); console.log(3);
Promise.resolve 快捷模式
Promise.resolve(32).then((value) => console.log(value))
Promise.reject
Promise.reject(new Error("Boom")).catch(err => console.log(err))
Fulfilled (resolve)
Rejected (reject)
unResolved (pending)