Runtimes
Node / Deno / Bun / edge2009 – todayJavaScript 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| V8 | Exposes 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. |
| Deno | A `Deno` namespace plus the Web standard globals on `globalThis`. `process` exists only inside the Node compatibility layer. |
| Bun | A `Bun` namespace AND the full Node global surface (`process`, `Buffer`, `require`) plus Web APIs — the widest set of the three. |