JavaScript Online Tool

Run JavaScript in an isolated browser frame and inspect console output.

SourceLines: 7 · Characters: 203
Templates
Validation:No syntax issues found.

What is an online JavaScript playground?

An online JavaScript playground is a code editor wired to a browser console: you write a snippet, press Run, and read the output without installing Node, opening DevTools or creating a file.

It is the quickest way to check a date helper, compare two array methods, or confirm what a promise resolves to. Every run here happens inside a sandboxed iframe on your own machine, so the snippet cannot reach the rest of this page.

How to run JavaScript online

  1. Type or paste your snippet into the JavaScript pane, or start from one of the four templates.
  2. Read the syntax check panel: acorn reports the first parse error with a line and column before anything runs.
  3. Press Run, or switch on Auto-run to re-execute about a second after you stop typing.
  4. Watch the console panel: log, info, warn, error and the completion value are listed in order, with total execution time.
  5. Code that touches document.body renders inside the sandbox output frame, not on this page.
  6. Press Stop to kill a runaway loop, then Format, copy, or download the snippet as snippet.js.

JavaScript runner examples

Log values and objects

const user = { name: "Ada", roles: ["admin"] }
console.log(user, 42)
LOG  {
  "name": "Ada",
  "roles": [
    "admin"
  ]
}
LOG  42

Catch a syntax error before running

let x = ;
Syntax check: Unexpected token (1:9)

Top-level await

const wait = (ms) => new Promise((r) => setTimeout(r, ms))
await wait(100)
console.log("done after 100 ms")
LOG  done after 100 ms
Executed in 104 ms

JavaScript playground vs browser DevTools

DimensionThis playgroundDevTools consoleNode.js locally
SetupOpen the page, nothing to installOpen DevTools on any pageInstall Node and start a REPL
IsolationSandboxed iframe, cannot touch this pageFull access to the page being debuggedFull access to your file system
Runaway loopStop replaces the iframeClose the tabCtrl+C the process
EditingMonaco with line numbers, templates and FormatOne-line prompt with historyEditor plus REPL, two windows
SharingCopy the snippet or download snippet.jsCopy line by line out of the logSave a file and send it
FAQ

JavaScript runner FAQ

Is my code uploaded to a server?

No. The snippet is executed in a sandboxed iframe inside your own browser tab, and nothing is sent anywhere.

Can I use async/await?

Yes. The snippet is wrapped in an async function before execution, so await works at the top level. Static import statements are not supported.

Why does localStorage throw inside the sandbox?

The iframe has an opaque origin by design, so storage and same-origin APIs are blocked. That is what keeps the snippet away from this site data.

How do I stop an infinite loop?

Press Stop. It throws the iframe away and loads a fresh one, which terminates whatever the old frame was still running.

Does console.log show nested objects?

Yes. Objects and arrays are serialized with indentation, circular references are marked, and Errors print their stack.

Can the snippet change the page I am looking at?

No. DOM changes appear in the sandbox output frame. The editor, console and rest of this page are separate documents.

Does it support TypeScript or JSX?

No, this runner executes plain JavaScript. Use the JSON tools for data work, or a TypeScript playground when you need type checking.

All Tools