最近面试中碰到了一道关于JS执行顺序的题目,题目比较基础,但是如果对于JS不熟的话,还是容易答不上来。再次记录和分析此次面试题,希望对大家有所帮助。
async function async1() {
console.log("async1 start");
await async2();
console.log("async1 end");
}
async function async2() {
console.log("async2");
}
console.log("js start");
setTimeout(function () {
console.log("timeout");
}, 0);
async1();
new Promise(function (resolve) {
console.log("promise");
resolve();
}).then(function () {
console.