Three initial lines: 1 Amina, 2 Kato and 3 Musa. Adding a fourth learner produces a fourth numbered line.
RUN JAVASCRIPT · FREE JAVASCRIPT TOOL
Online JavaScript Playground & Console
Run JavaScript in an isolated browser sandbox and capture console output without installing Node.js.
Ready in your browser
Your processed result will appear here.
A WORKED TASK
Use console output to understand a short script
Run the learners example and compare each name with its printed number. forEach visits each entry, while index + 1 gives people-friendly numbering starting at 1. Add a fourth name, run again and check that the output gains a fourth line without changing the loop.
This executes in a short-lived browser worker, not Node.js or a webpage DOM. document, require and desktop file access are unavailable. It is intended for small, reviewed examples, not running unknown programs.
What to check
- Use console.log to make values visible. Declaring a variable alone does not print it.
- A ReferenceError usually names a value used before it was available.
- Long-running programs stop after the runner’s time limit. Simplify a loop before retrying.
TESTED & REVIEWED
Know what this tool does—and where to double-check
- Reviewed by
- HTML Online Viewer project
- Last reviewed
- Processing
- Ordinary processing happens in this browser tab; the tool does not intentionally upload your source.
- Important limitation
- JavaScript checks and transformations cannot prove that application logic is correct. Test the result in its real project before publishing.
PRACTICAL EXAMPLE
Start with a small JavaScript Playground example
The built-in sample makes the accepted input visible before you use your own project data.Example input
const learners = ['Amina', 'Kato', 'Musa'];
learners.forEach((name, index) => console.log(index + 1, name));Run the sample first, then change one value at a time so each result remains easy to explain.
What this example demonstrates
Run JavaScript in an isolated browser sandbox and capture console output without installing Node.js.
Keep the original file, review the generated result and test production code in its real application before publishing.
COMMON QUESTIONS
JavaScript Playground FAQ
Is JavaScript Playground free?
Yes. It is free to use and requires no account.
Does JavaScript Playground upload my source?
No. Ordinary processing happens locally in the current browser. The JavaScript runner uses a short-lived isolated browser worker.
Can I import and export a file with JavaScript Playground?
Yes. Import a relevant JavaScript, JSON or text file, then save the input or processed result.