关于宏任务、微任务以及事件轮询机制的一道面试题!

闲来摸鱼的瞅瞅看😂


async function asyncA() {
console.log("1");
await asyncB();
console.log("2");
}
async function asyncB() {
console.log("3");
}
console.log("4");
setTimeout(() => {
console.log("5");
Promise.resolve().then(function () {
console.log("6");
});
}, 0);
setTimeout(() => {
console.log("7");
Promise.resolve().then(function () {
console.log("8");
});
}, 0);
asyncA();
new Promise(function (resolve) {
console.log("9");
resolve();
}).then(function () {
console.log("10");
});
console.log("11");
展开
小丑先森于2020-11-16 11:02发布的图片
15
评论