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.

Block-scoped bindings still hoist, but into a temporal dead zone: touching them before initialisation throws instead of yielding undefined.

{
  try {
    console.log(count); // TDZ
  } catch (err) {
    console.log(err.name + ":", err.message);
  }
  let count = 1;
  console.log("after init:", count);
}

for (let i = 0; i < 3; i++) {
  setTimeout(() => console.log("let i =", i), 0); // 0, 1, 2
}

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