JavaScript Online Compiler
Write, run and share JavaScript in your browser. Instant, free, no sign-up.
// Welcome to the CodingHumans JavaScript compiler.
// Press Run (or Ctrl + Enter) to execute your code.
const name = prompt("What's your name?");
console.log(`Hello, ${name || "CodingHumans"}!`);
const squares = [1, 2, 3, 4, 5].map((n) => n * n);
console.log("Squares:", squares);
Press Run to see the output.
JavaScript examples to try
Hello, World
Print a line of text to the console.
Reverse a string
Split a string into characters, reverse them and join them back.
Check a prime number
Test divisors up to the square root of the number.
Fibonacci series
Print the first n Fibonacci numbers.
Promises with async/await
Wait for a timer with await, the way you would wait for a network request.
map, filter and reduce
Transform, filter and total an array of objects.
How to run JavaScript online
- Write or paste your JavaScript in the editor.
- Press Run, or Ctrl + Enter (Cmd + Enter on a Mac).
- If your program calls prompt(), type the answer in the output panel and press Enter.
- Press Share to copy a link to your code. Anyone who opens it sees exactly what you wrote.
About this JavaScript compiler
This free JavaScript compiler runs your code directly in your browser, so there is no server queue and no waiting: press Run and the output appears instantly. It supports modern JavaScript (ES2023), including let and const, arrow functions, classes, destructuring, template literals, optional chaining and top-level await.
Your code runs in a separate background thread, isolated from the page. If you write an endless loop, press Stop and only your program is stopped; the editor keeps your code.
It is built for learning and quick experiments: try a snippet from a tutorial, test an interview answer, or check how a method behaves before you use it in a project.
Frequently asked questions
›Is this JavaScript compiler free?
Yes. It is completely free with no sign-up and no limit on how many times you run your code. Your code runs in your own browser, which is what keeps it free.
›Does it support user input?
Yes. Call prompt() and the program pauses while you type the answer in the output panel, just like a real console.
›Can I use async/await and promises?
Yes. Top-level await works, and so do promises, setTimeout and setInterval. The program finishes when your code and all its pending timers are done.
›Does it run Node.js code?
It runs standard JavaScript. Browser-only and Node-only APIs such as document, require("fs") or process are not available, because the code runs in an isolated worker.
›Is my code saved?
Your latest code is saved in this browser automatically, so it is still there when you come back. Nothing is sent to our servers. Use Share to get a link you can keep or send.