1const myPromise = () => Promise.resolve('I have resolved!') 2 3function firstFunction() { 4 myPromise().then(res => console.log(res)) 5 console.log('second') 6} 7 8async function secondFunction() { 9 console.log(await myPromise()) 10 console.log('second') 11} 12 13firstFunction() 14secondFunction()
本题为"单选题"
参考答案:
正确选项:D:second, I have resolved!, I have resolved!, second
该题执行顺序为:
此时同步任务执行完成,执行微任务队列中的任务因此最终结果为 second, I have resolved, I have resolved, second
,所以答案为 D
最近更新时间:2023-03-04
题库维护不易,您的支持就是我们最大的动力!