【发布时间】:2018-12-07 07:12:19
【问题描述】:
以下是承诺链代码:
new Promise(function(resolve, reject) {
console.log('first');
resolve('yes');
}).then(
new Promise(function(resolve, reject) {
console.log('second');
reject('no');
})
).catch(rej => console.log(rej));
输出是:
'第一'
'秒'
我希望得到一个“否”输出,但没有。 不知道为什么 catch 没有捕捉到第二个 .then() 的拒绝?
【问题讨论】:
标签: javascript ecmascript-6 es6-promise