JavaScript Online Tool
Run JavaScript in an isolated browser frame and inspect console output.
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
- Type or paste your snippet into the JavaScript pane, or start from one of the four templates.
- Read the syntax check panel: acorn reports the first parse error with a line and column before anything runs.
- Press Run, or switch on Auto-run to re-execute about a second after you stop typing.
- Watch the console panel: log, info, warn, error and the completion value are listed in order, with total execution time.
- Code that touches document.body renders inside the sandbox output frame, not on this page.
- 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 42Catch 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
| Dimension | This playground | DevTools console | Node.js locally |
|---|---|---|---|
| Setup | Open the page, nothing to install | Open DevTools on any page | Install Node and start a REPL |
| Isolation | Sandboxed iframe, cannot touch this page | Full access to the page being debugged | Full access to your file system |
| Runaway loop | Stop replaces the iframe | Close the tab | Ctrl+C the process |
| Editing | Monaco with line numbers, templates and Format | One-line prompt with history | Editor plus REPL, two windows |
| Sharing | Copy the snippet or download snippet.js | Copy line by line out of the log | Save a file and send it |
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.