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

1const first = () => (new Promise((resolve, reject) => { 2 console.log(3); 3 let p = new Promise((resolve, reject) => { 4 console.log(7); 5 setTimeout(() => { 6 console.log(5); 7 resolve(6); 8 console.log(p) 9 }, 0) 10 resolve(1); 11 }); 12 resolve(2); 13 p.then((arg) => { 14 console.log(arg); 15 }); 16})); 17first().then((arg) => { 18 console.log(arg); 19}); 20console.log(4); 21
难度:
2022-01-09 创建

赞赏支持

预览

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