About the JavaScript Runner tool
When you want to check what a line of JavaScript returns, test a small function or experiment with an array method, opening a full project is overkill. This JavaScript runner lets you type code and see the console output right away, like a scratchpad version of the browser console with a proper editor.
Everything you log with console.log, console.info, console.warn or console.error appears in the console panel, with objects printed as formatted JSON. Uncaught errors and rejected promises are reported with their line number. An optional timer logs how many milliseconds the script took. Switch on “Run as ES module” to use top-level await and import modules from CDN URLs. Because the code runs in a real document, you can also write to document.body and see it in the output frame.
The runner re-executes your script shortly after you stop typing. It uses your browser's own JavaScript engine inside a sandboxed frame, so the code has no access to this site and is never sent to a server. You can download the script as a .js file when you are done.
How to use JavaScript Runner
- Type or paste JavaScript into the “JavaScript” editor, or keep the sample to see how it works.
- Read the output in the console panel; warnings are yellow and errors red.
- Turn on “Run as ES module” if you need top-level await or import statements.
- Press “Re-run” to execute the code again, for example after random values or timers.
- Click “Download” to save your code as script.js.
Features
Real console output
console.log, info, warn and error are captured, and objects are pretty-printed.
Error line numbers
Uncaught exceptions and unhandled promise rejections are shown with the line they came from.
ES module mode
Enable top-level await and import from URLs such as esm.sh or jsDelivr.
Run-time measurement
An optional message reports how long the script took in milliseconds.
Sandboxed execution
Code runs in an isolated frame in your own browser, never on a server.
When to use it
- Quickly check how Array.map, reduce or sort behave with sample data.
- Test a regular expression or date formatting snippet before adding it to your app.
- Practise JavaScript exercises and see results without a local setup.
- Debug a small function by adding console.log calls step by step.
- Try a new language feature supported by your browser, such as structuredClone or Array.at.
Frequently asked questions
Is this Node.js?
No. The code runs in your browser's JavaScript engine, so browser APIs like fetch and document are available but Node modules such as fs or require are not.
Can I use async/await?
Yes. Inside async functions it always works. For await at the top level of the script, switch on “Run as ES module”.
What happens with an infinite loop?
A never-ending loop blocks the preview frame and can make the page unresponsive, as it would in any browser tab. Reload the page to recover.
Can I fetch data from an API?
You can call fetch, but the request comes from a sandboxed frame with an opaque origin, so only APIs that allow any origin through CORS will respond.
Is my code stored anywhere?
No. It stays in your browser while the page is open. Use Download to keep a copy.