【发布时间】:2022-08-14 14:16:49
【问题描述】:
我一直在研究 promise、await 和 async 函数。当我刚刚处于学习承诺的阶段时,我偶然发现了这个:
async function async1(){
console.log(\'Async 1\');
await func2(); // *
console.log(\'AFter Async 1\');
}
async function async2(){
console.log(\'FROM async 2\');
}
async1();
console.log(\'Synchronous\'); //**
结果如下:
Async 1
FROM async 2
Synchronous
AFter Async 1
代码如何从 * 跳转到 **。这里如何使用微任务?
标签: javascript asynchronous async-await