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.

Async Era

ES2017+2017 – 2019

`async`/`await` made the microtask queue an everyday concern. Asynchronous code finally reads top-to-bottom while still yielding to the loop at each await.

An async function returns a promise and suspends at every `await`, popping its frame off the call stack and resuming later as a microtask. Run this in the visualizer to watch the frame leave and come back.

async function fetchStep(label) {
  console.log("enter", label);
  await null;             // suspends here, resumes as a microtask
  console.log("resume", label);
  return label;
}

async function main() {
  const a = await fetchStep("A");
  const b = await fetchStep("B");
  console.log("done:", a, b);
}

main();
console.log("this line runs before any resume");

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