Promise.resolve()
.then( value => { console.log(0); return Promise.resolve({
then() { console.log(1);
}
})
})
.then( value => {
return Promise.resolve({
then() { console.log(2);
}
})
})
.catch(()=>{ console.log('not yet');
})
1 回答
慕姐8265434
TA贡献1813条经验 获得超2个赞
MDN promise thenablethenable是这样用的
Promise.resolve({
then(resolve) { console.log(1);
resolve(2)
}
}).then(v=>{ console.log(v) //2})添加回答
举报
0/150
提交
取消
