01
Execution Model
The consequences of single-threaded execution; the event loop's call stack and task and microtask queues; what timers actually mean; and callback-based asynchrony.
- 01 The Single-Threaded Model JavaScript's single-threaded, run-to-completion execution model; the consequences of blocking work; the boundary between the language's core and the asynchronous abilities the runtime provides.
- 02 The Event Loop The distinction between the call stack, the task queue, and the microtask queue; the event loop's turn rule; justifying a mixed example's output order line by line.
- 03 Timers The delay as a lower bound, the order of equal-delay timers, drift and overlap in interval scheduling, the self-scheduling loop, and cancellation.
- 04 Callbacks The error-first callback contract, setting up sequential and combined processing by hand, the nesting problem, and the uncertainties that come from handing control to the callee.