js 宏微任务执行顺序
2021-01-09 21:30
标签:log res span http tps rip com start col 一,直接打开地址查看 输出 script start 》script end》 promise1 》promise2》setTimeout js 宏微任务执行顺序 标签:log res span http tps rip com start col 原文地址:https://www.cnblogs.com/qingjiawen/p/13511481.htmlhttps://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/
console.log(‘script start‘);
setTimeout(function () {
console.log(‘setTimeout‘);
}, 0);
Promise.resolve()
.then(function () {
console.log(‘promise1‘);
})
.then(function () {
console.log(‘promise2‘);
});
console.log(‘script end‘);