JavaScript事件循环规则详解
原文英文,约200词,阅读约需1分钟。发表于: 。As is well known, Javacript is a single thread language, but why can we use asynchronous operation? Because asynchronous operations are executed by a browser with multi-thread and multi-process...
JavaScript是单线程语言,但通过浏览器的多线程和多进程能力实现异步操作。任务分为同步、微任务和宏任务,执行顺序为同步->微任务->宏任务。微任务示例包括Promise.then(),宏任务示例包括setTimeout。process.nextTick()在同步代码后、微任务前执行。