Nodejs事件循环究竟宏任务先执行还是微任务先执行?

发布于 1周前 作者 nodeper 来自 nodejs/Nestjs

Nodejs事件循环究竟宏任务先执行还是微任务先执行?
查了下 stack overflow 都说是先执行宏任务。。。
One go-around of the event loop will have exactly one task being processed from the macrotask queue (this queue is simply called the task queue in the WHATWG specification). After this macrotask has finished, all available microtasks will be processed, namely within the same go-around cycle. While these microtasks are processed, they can queue even more microtasks, which will all be run one by one, until the microtask queue is exhausted
这和国内面试题解释完全不一样啊


回到顶部