Node.js
v24.12.0
Node.js
v24.12.0
JavaScript is a high-level, dynamically typed language originally created by Brendan Eich at Netscape in 1995 for adding interactivity to web pages. It is multi-paradigm, blending prototype-based object orientation, functional features like first-class functions and closures, and an event-driven model. The language is standardized as ECMAScript, with new editions adding features such as arrow functions, async/await, and modules.
Node.js, first released in 2009, brought JavaScript to the server by pairing the V8 engine with non-blocking I/O. Today server-side JavaScript powers web APIs, real-time apps, build tooling, and command-line utilities, with an enormous package ecosystem on npm. This compiler runs Node.js 24, executing scripts outside the browser, so DOM and window are not available but the full Node runtime and standard library are.
console.log("Hello, World!");const data = require("fs").readFileSync(0, "utf8").trim();
console.log(`Hello, ${data}!`);const fruits = ["apple", "banana", "cherry"];
fruits.forEach((fruit, i) => {
console.log(i + 1, fruit);
});function factorial(n) {
return n <= 1 ? 1 : n * factorial(n - 1);
}
console.log(factorial(5));try {
const obj = JSON.parse("{ bad json");
console.log(obj);
} catch (err) {
console.error("Parse failed:", err.message);
}const counts = new Map();
for (const ch of "banana") {
counts.set(ch, (counts.get(ch) || 0) + 1);
}
console.log([...counts.entries()]);
console.log(new Set([1, 1, 2, 3]));const s = " Hello, World ";
console.log(s.trim().toLowerCase());
console.log(s.trim().split(", "));
console.log(["a", "b", "c"].join("-"));class Person {
constructor(name, age) {
this.name = name;
this.age = age;
}
}
const people = [new Person("Ada", 36), new Person("Bob", 28)];
people.sort((a, b) => a.age - b.age);
people.forEach(p => console.log(p.name, p.age));const nums = [1, 2, 3, 4, 5];
const result = nums.filter(n => n % 2 === 1).map(n => n * n);
console.log(result);
console.log(nums.reduce((a, b) => a + b, 0));function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function main() {
await delay(10);
console.log("done");
}
main();Yes. You can run server-side JavaScript in your browser on CompileBytes with no Node.js installation required.
It runs Node.js 24.12.0, so you can use modern ECMAScript features including top-level await, optional chaining, and the latest built-in modules.
Read from file descriptor 0, for example require('fs').readFileSync(0, 'utf8'), and type your input into the stdin box before running.
Yes, executing JavaScript on CompileBytes is free and requires no account.
No. This runs Node.js on the server, so DOM, document, and window are unavailable, but Node's standard modules like fs and path work.