Engines, JIT & the Event Loop (Overview) in JavaScript
JavaScript runs on engines — V8 (Chrome, Node), SpiderMonkey (Firefox), JavaScriptCore (Safari) — that parse source and Just-In-Time compile hot code to machine code, optimizing and deoptimizing as types change under them. You never invoke the compiler yourself; it lives inside the runtime.
Execution centers on the event loop: one call stack runs your code while async results (timers, network, I/O) queue as tasks, processed when the stack empties. This single-threaded model is why long synchronous loops freeze pages — and why async patterns exist. Full detail arrives in the Async module; this is the mental model to carry there.
Engines compile invisibly
V8 and friends parse your source and JIT-compile hot paths — deployment is still just shipping text files.
One call stack
Functions nest on a single stack; it must empty before anything else (timers, clicks, fetches) gets handled.
Tasks queue behind it
Async completions wait in task/microtask queues until the stack clears — ordering guarantees flow from this, covered in Async.
Blocking freezes everything
A 3-second synchronous loop blocks rendering, input, and timers alike — the cardinal sin async code exists to avoid.
console.log("first");setTimeout(() => console.log("third"), 0);console.log("second");Recommended resourcesAffiliate links · may earn us a commission
Recommended for learners
Practice what you learned
Re-implement each visualized algorithm in JavaScript yourself — building beats watching.