标签: V8引擎
7 个内容
笔记(6)
JavaScript 类型系统区分值类型和引用类型,影响内存存储和操作。通过 `typeof` 和 `instanceof` 进行类型判断,需注意其局限性。V8引擎使用隐藏类和指针标记优化类型处理。理解类型底层机制、内存管理及关注新提案,能编写更高效的 JavaScript 代码。
动态(1)
The queueMicrotask() method, which is exposed on the Window or Worker interface, queues a microtask to be executed at a safe time prior to control returning to the browser's event loop.
First, nextTick queue is checked to get tasks for its execution, once it is exhausted, the microTasks queue is checked. After finishing the tasks in the microtask queue the process of checking nextTick and microTasks queues are repeated until the queues have been emptied.
They have different queues. The nextTick's queue is managed by node and the microtask one is managed by v8.
The nextTick queue is checked first after the current function/script execution, and then the microTask one.