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.

The language has no file, socket, or HTTP APIs — every runtime invented its own. The same three lines of code look completely different in Node, Deno, and Bun, which is why code is rarely portable without a shim layer.

// Reading a file, three ways. None of these APIs exist in the ECMAScript
// spec — fetch is the only host API shared across every runtime.

const nodeJs = `import { readFile } from "node:fs/promises";
const text = await readFile("config.json", "utf8");`;

const deno = `const text = await Deno.readTextFile("config.json");`;

const bun = `const text = await Bun.file("config.json").text();`;

console.log("Node.js", nodeJs);
console.log("Deno", deno);
console.log("Bun", bun);
console.log("Common everywhere: fetch");
The standard library gap
V8No I/O APIs at all — `fs`, `net`, `http`, even `console` and `setTimeout` are supplied by the host. The engine cannot open a file by itself.
// the engine can't open a file —
// fs/net/http are host APIs, not language features
Node.jsThe original server stdlib: `fs`, `http`, `net`, `crypto`, `child_process` under the `node:` namespace. Callback-first heritage, promisified in `node:fs/promises`.
import { readFile } from "node:fs/promises";
const text = await readFile("config.json", "utf8");
Deno`Deno.*` globals (`Deno.readTextFile`, `Deno.serve`, `Deno.Kv`) plus a curated standard library on deno.land/std, all behind explicit permission flags.
const text = await Deno.readTextFile("config.json");
// needs --allow-read
Bun`Bun.*` globals (`Bun.file`, `Bun.serve`, `Bun.sql`) plus drop-in Node API compatibility — a faster, batteries-included replacement.
const text = await Bun.file("config.json").text();

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