js eventLoop
Promise.resolve().then(function () {
console.log("1");
Promise.resolve().then(function () {
console.log("2");
});
});
setTimeout(function () {
Promise.resolve().then(function () {
console.log("5");
});
}, 0);
setTimeout(function () {
console.log("6");
}, 0);
// 执行结果是 1 2 5 6 . 先执行同步脚本,再执行完微任务队列,然后执行第一个宏任务队列的任务,然后检查是否有微任务

浙公网安备 33010602011771号