Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Node.js took JavaScript out of the browser in 2009 and turned it into a serious backend platform — LinkedIn, Walmart, Netflix, and Uber all run production services on it, and npm grew into the largest package registry in the world around it. Built on Chrome's V8 engine with an event-driven, non-blocking I/O model, Node excels at APIs, command-line tools, and build tooling. XCODX runs your script on a current LTS release of Node inside a live terminal session: stdout streams in real time and process.stdin is wired to your keyboard, so readline-based prompts behave exactly as they would in a local shell — no nvm, no install.
const readline = require("node:readline/promises");
async function main() {
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
const name = await rl.question("What's your name? ");
const count = Number(await rl.question("How many greetings? "));
for (let i = 1; i <= count; i++) {
console.log(`${i}. Hello, ${name}!`);
}
rl.close();
}
main();
Sketch backend logic before wiring it into Express or Fastify, test JSON transformations and string parsing for an API layer, or answer the classic Node interview questions — event loop ordering, promises versus callbacks, stream behavior — with runnable proof. HackerRank and CoderPad both deliver input over stdin in their Node environments, so practicing here with readline is a one-to-one rehearsal. It's also handy for trying a built-in module like crypto or url without creating a whole project folder.
It does. Your script gets a real terminal, so readline questions, rl.on('line') handlers, and raw process.stdin reads all wait for live keyboard input while the program runs. That makes stdin-driven challenge formats and interactive CLI prototypes work without any workarounds.
A modern long-term-support (LTS) release, so contemporary features — async/await, optional chaining, node: prefixed imports, structuredClone, fetch — are available. If your code depends on behavior from a specific older version, test locally with that exact release before relying on it.
Third-party npm packages can't be installed in the sandbox, and long-running servers aren't the right fit for a timed run. All core modules work, though: fs, http, path, crypto, events, streams. For learning Node fundamentals and interview prep, the built-ins cover nearly everything.
main.jsjavascriptrequire("readline") or process.stdinconsole.log("Hello from JavaScript!");
const name = "Developer";
console.log(`Welcome, ${name}!`);