JS

runtime.js

One spine: the evolution of JavaScript

Pick an era, expand a concept, and see where it lands in today's runtimes. Every snippet can be dropped straight into the sandboxed console — the event loop panel then shows real, instrumented execution, not a looping animation.

ES6 / 2015

ES20152015

The largest single revision of the language. Block scoping, lexical `this`, class syntax, and a standardised Promise — the foundation of every later feature.

A standard object for a value that is not here yet — and, crucially, a standard scheduling rule: reactions run on the microtask queue, always after the current synchronous run to completion.

console.log("1 sync");

setTimeout(() => console.log("4 macrotask"), 0);

Promise.resolve()
  .then(() => console.log("3 microtask"));

console.log("2 sync");
Microtask draining across runtimes
V8Owns the microtask queue itself; the host decides when checkpoints run. `queueMicrotask` and promise reactions share one FIFO queue.
Node.jslibuv drives phases; microtasks drain after each macrotask AND between each `process.nextTick` batch — nextTick jumps ahead of promises.
DenoTokio event loop over V8, no nextTick queue in native code — promise ordering matches the browser far more closely.
BunJavaScriptCore instead of V8; microtask semantics are spec-identical, but timer resolution and task batching differ measurably.

Interview gotchas

15 genuinely tricky, well-known snippets — event-loop ordering, closures in loops, and `this`-binding traps. Open one, read the gotcha, then drop it straight into the sandboxed console to watch it really run.

Event loop
Closures & scope
this binding
Promises & async
Coercion & equality
Built-in traps