问答题964/1515【Promise第24题】下面代码的输出是什么?

1function promise1 () { 2 let p = new Promise((resolve) => { 3 console.log('promise1'); 4 resolve('1') 5 }) 6 return p; 7} 8function promise2 () { 9 return new Promise((resolve, reject) => { 10 reject('error') 11 }) 12} 13promise1() 14 .then(res => console.log(res)) 15 .catch(err => console.log(err)) 16 .finally(() => console.log('finally1')) 17 18promise2() 19 .then(res => console.log(res)) 20 .catch(err => console.log(err)) 21 .finally(() => console.log('finally2')) 22
难度:
2022-01-09 创建

赞赏支持

预览

题库维护不易,您的支持就是我们最大的动力!