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.

Runtimes

Node / Deno / Bun / edge2009 – today

JavaScript is no longer one host. The language spec is shared; the I/O, permissions, and module story are not — and that is where the real differences live.

Every runtime exposes a different global surface, so portable libraries branch on `typeof`: `process` means Node or Bun, `Deno` means Deno, `Bun` means Bun. Run this in the sandbox and you'll see a browser-like host.

// Feature-detect the host — each runtime exposes different globals:
console.log("typeof process:", typeof process); // Node.js, Bun
console.log("typeof Deno:", typeof Deno);       // Deno only
console.log("typeof Bun:", typeof Bun);         // Bun only
console.log("typeof fetch:", typeof fetch);     // all modern runtimes
console.log("typeof window:", typeof window);   // browsers & edge
Which globals each host exposes
V8Exposes only the language plus whatever the embedder injects onto `globalThis` — the engine itself knows nothing about `process`, `window`, or `Deno`.
Node.js`process`, `Buffer`, `require`, `module`, plus web-ish `setTimeout`/`fetch`. No `window` — the browser globals are deliberately absent.
DenoA `Deno` namespace plus the Web standard globals on `globalThis`. `process` exists only inside the Node compatibility layer.
BunA `Bun` namespace AND the full Node global surface (`process`, `Buffer`, `require`) plus Web APIs — the widest set of the three.

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