About this tool
Try out an idea, check how a built-in method behaves or debug a small function without opening a project. Code runs inside a sandboxed frame with top-level await, and console.log output, objects, arrays, errors and rejected promises appear in a readable console. The sandbox has no network access and cannot touch this page, its cookies or your storage.
How to use JavaScript Playground
- Type or paste JavaScript into the editor.
- Press Run or Ctrl+Enter.
- Read the output in the console panel.
- Press Stop to discard a run that is still going.
Frequently asked questions
Can I use fetch or import packages?
No. Network requests are blocked by the sandbox, so fetch calls and imports from URLs fail. The playground is for plain, self-contained JavaScript.
What if my code has an infinite loop?
A tight endless loop can freeze the browser tab. Reload the page: code never runs automatically, only when you press Run.
Which JavaScript version is supported?
Whatever your browser supports. Modern browsers run current ECMAScript, including classes, async/await, optional chaining and top-level await.