JavaScript Runner

Write JS and hit run; captures console.log/warn/error output and shows execution time.

Executed with new Function, console output captured, never leaves the browser.

JavaScript runner: execution context, console capture and the security boundary

How your code gets executed

The tool hands your input to new Function, building a function from it and running it. The consequences:

This leads to a boundary that must be stated plainly — see the security section below.

How console output is captured

The tool temporarily replaces console.log, console.error, console.warn and friends, collecting their arguments into the output panel. What that means in practice:

CaseBehaviour
console.log('a', 1)shown joined in order
console.log({a:1})depends on the implementation; may show [object Object]; the safe form is JSON.stringify(obj, null, 2)
console.table / console.groupusually not captured; use log instead
the browser devtools consolestill available (you can see it there); capture is just an extra copy

The tool also shows execution time, a rough sense of an operation's scale (comparing two algorithms, or whether a loop is acceptable). But this is a single run's wall-clock time, affected by JIT warm-up and current load — not a benchmark. For real performance, run many iterations in devtools and take the median, or use a dedicated benchmarking tool.

Handling asynchronous code

Support for async is usually limited:

Security boundary — a clear discipline

Because the code executes directly in the page context, it can reach this site's storage and network. This site has no account system and stores no personal data, so the risk is limited, but the discipline still holds:

If you only want to try an algorithm that touches no sensitive data, this tool is convenient; for credentials or untrusted sources, pick the better-isolated option.

Typical uses

Everything runs locally; the code is not uploaded.

FAQ

Why can't I use top-level const/let?

The code is wrapped in the new Function body, where const/let work fine in function scope; use a function-style return when needed.