const p1 = new Promise(function (resolve, reject) {
setTimeout(() => reject(new Error('fail')), 3000)
})const p2 = new Promise(function (resolve, reject) {
setTimeout(() => resolve(p1), 1000)
})
p2
.then(result => console.log(result))
.catch(error => console.log(error))// Error: fail初学Promise,看了阮一峰老师的教程,这里看不懂,为什么p1的状态决定p2的状态,按我理解不是直接console.log(p1)么
添加回答
举报
0/150
提交
取消