JavaScript playground
An online JavaScript compiler with a real console. Type, press Run, read the output. Top-level await works.
const name = "world"
console.log(`Hello, ${name}!`)
for (let i = 1; i <= 3; i++) {
console.log(`${i} squared is ${i * i}`)
}
A quick JavaScript console that stays out of the way
Use it to check how an array method behaves, test a regular expression, try a snippet from Stack Overflow, or prototype a function before it goes into your project. Objects, Maps and Sets are pretty-printed; errors show in red with their message.
Because code runs in a separate worker, a runaway loop can’t freeze this page. Ctrl/⌘ + Enter runs, and the Share button copies a link that contains your code.
For reference while you work: the JavaScript cheat sheet, the array methods list, and a step-by-step async/await explainer that shows exactly when each line runs. Writing HTML too? Switch to the HTML, CSS & JS playground.
Frequently asked questions
Where does my JavaScript run?
In a Web Worker in your own browser, isolated from this page. console.log, console.error, console.table and console.time are captured and shown in the output panel.
Can I use await at the top level?
Yes. Your code runs inside an async function, so you can write await directly without wrapping it.
Can I access the DOM?
Not in this console-style playground: workers have no document. For code that touches HTML elements use the HTML, CSS & JS playground, which renders a live page.
Does it support modern syntax?
It supports whatever your browser supports: current Chrome, Firefox and Safari run ES2023+ features like optional chaining, private class fields, Array.prototype.toSorted and Object.groupBy.
What happens with an infinite loop?
After 8 seconds the worker is terminated and you get a message. Press Stop at any time to end the run yourself.