「No.68」【 每日壹题 】

2/9/2020 异步

当你发现自己的才华撑不起你的野心时,就请安静下来学习吧!

🌿【壹题】🌿 (头条)异步笔试题

请写出下面代码的运行结果

async function async1() {
    console.log('async1 start');
    await async2();
    console.log('async1 end');
}
async function async2() {
    console.log('async2');
}
console.log('script start');
setTimeout(function() {
    console.log('setTimeout');
}, 0)
async1();
new Promise(function(resolve) {
    console.log('promise1');
    resolve();
}).then(function() {
    console.log('promise2');
});
console.log('script end');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

鲁迅说过:答案仅供参考...

🌿【解析】🌿

参考答案 (opens new window) --- 感谢【Daily-Interview-Question】 (opens new window)

Last Updated: 2/18/2020, 5:44:41 PM
    asphyxia
    逆时针向