JavaScript Playground
Run a JavaScript snippet in the page and read its console output, return value and timing.
JavaScript Playground
Run a snippet and see its console output, return value and timing. Top-level await and return work, so you can try an API call or a quick algorithm. Press Ctrl/Cmd + Enter to run.
Output
The snippet runs in this page rather than a sandbox, so it can read and change the page. Only run code you trust, the same rule as a browser console.
History tool ini
Data terakhir yang pernah kamu isi di tool ini, tersimpan hanya di device/browser ini.
Save what you type here, in this browser? Your work would go into this browser's local storage, so a refresh or a trip to another tool does not wipe it. You also get a short list of previous entries under the form, each one restorable with a click. Nothing is ever uploaded, and there is no account.
Being straight about the trade-off: anything kept there can be read by anyone who can use this browser profile, and by any script that later runs on this site. A tool page can hold a private key, a password or a signed token. Saving is convenient; it is not private.
About this tool
A small console for trying JavaScript without leaving the page. Write a snippet, press Run, and see everything it logs, the value it returns and how long it took. Top-level await is supported, so you can experiment with promises and fetch as well as plain expressions.
Questions
- Can I use top-level await?
- Yes. The snippet is wrapped in an async function, so await works at the top level and return gives back a value. That also means you do not need to wrap everything in an async IIFE yourself.
- Is the code sandboxed?
- No. It runs in the page with the page's own privileges, exactly like the browser's developer console. That keeps it simple and lets it touch real APIs, but it also means you should only run code you trust.
- Why did my console.log output not appear?
- Only output produced while the snippet runs is captured, and the snippet has to finish for the run to end. If it throws, the error is shown instead and anything logged before the throw is still listed.
- Does it remember my code between visits?
- The editor starts from a small example each time. If you want to keep a snippet, use Copy code before you leave, or paste it into your own notes.