Account

What new tool do you want?

Developer Tools

JavaScript & TypeScript Playground

Run JavaScript or TypeScript in your browser with a real console — console.log, console.table, async/await, fetch and timers. Stop runaway loops, and share snippets as a link.

How to use

  1. 1Write or paste code (or load an example).
  2. 2Press Run or Ctrl+Enter — output appears in the console panel.
  3. 3Use Share link to send the snippet to someone; the code travels inside the link.

Frequently asked questions

Is my code sent to a server?

No. It runs in an isolated Web Worker inside your browser, and nothing is stored anywhere except this browser.

Can I use the DOM or import npm packages?

The worker has no document or window. Instead of import statements, load ES modules at runtime with await import("https://esm.sh/<package>").

Is TypeScript type-checked?

Types are stripped so the code runs instantly, but they aren't checked — use your editor or tsc for type errors.

What happens with an infinite loop?

The run is stopped automatically at the time limit (10 s by default), or when you press Stop.

A real JS engine, deliberately missing the DOM

Code runs inside an actual Web Worker — not an interpreter written in JavaScript — so performance, async/await, generators and modern syntax all behave exactly as they would in a script tag. The trade-off is that workers have no document or window: there's no DOM to manipulate, which is the right constraint for testing algorithms, data transforms or API responses, but the wrong tool for anything that needs to render HTML (the HTML/CSS/JS editor covers that case instead). Because import statements don't resolve inside a worker built from a blob URL, packages load at runtime instead, via await import("https://esm.sh/<package>").

The console output is hand-built to look like Node's

There's no browser DevTools attached to the worker, so the playground ships its own formatter that recursively renders arrays, Maps, Sets, class instances, circular references ([Circular]), and nested objects the way Node's util.inspect does — including wrapping objects onto multiple lines once a single-line render passes 72 characters. console.table is reimplemented from scratch as a Unicode box-drawing grid, and console.time/timeEnd, console.count and console.assert all work because the worker script wires them to the same console object the user's code calls into.

TypeScript is stripped, not checked

Selecting the TypeScript tab runs the code through Sucrase before execution, which deletes type annotations fast enough to feel instant but performs no type checking at all — code with a type error that would fail tsc will still run here if it's otherwise valid JavaScript once the types are stripped. That makes this the wrong place to catch type bugs and the right place to quickly check runtime behavior of TypeScript-flavored code.

Worked example: the Hello world sample

The default snippet logs a template string, sorts and sums an array, and prints an object. Run it and the console shows exactly: Hello, world! — then sorted: [ 1, 2, 3, 5, 8, 9 ] — sum: 28 — { max: 9, min: 1 } — followed by a system line like Finished in 2.41 ms. Switching the time limit to 5 seconds and writing while(true){} demonstrates the other half of the system: after 5 seconds the worker is terminated and a 'Stopped: still running after 5 s (infinite loop?)' message appears instead of a frozen tab.

Related tools

More: Developer Tools