Closed oliver1204 closed 5 years ago
输出下列结果:
promise() .then(() => { console.log('1') }) .then(() => { console.log('2') }) .catch(() => { console.log('3') }) .then(() => { console.log('4') })
实现方式:
function one(resolve, reject){ console.log('1'); setTimeout(()=>{ reject('3'); }, 2000); } function two(clothes){ console.log('2'); setTimeout(()=>{ console.log('4'); }, 3000); } new Promise(one) .catch(two())
promise 解析
输出下列结果:
实现方式:
promise 解析