问答题781/1530【Promise第39题】下面代码的输出是什么?

1const async1 = async () => { 2 console.log('async1'); 3 setTimeout(() => { 4 console.log('timer1') 5 }, 2000) 6 await new Promise(resolve => { 7 console.log('promise1') 8 }) 9 console.log('async1 end') 10 return 'async1 success' 11} 12console.log('script start'); 13async1().then(res => console.log(res)); 14console.log('script end'); 15Promise.resolve(1) 16 .then(2) 17 .then(Promise.resolve(3)) 18 .catch(4) 19 .then(res => console.log(res)) 20setTimeout(() => { 21 console.log('timer2') 22}, 1000) 23
难度:
2022-01-09 创建

赞赏支持

预览

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