What is REPL in Node.js and what is it used for?
REPL stands for Read–Eval–Print–Loop. It's an interactive shell that comes built into Node.js — you start it by typing node in the terminal.
Read — reads the user's input
Eval — evaluates the JavaScript expression
Print — prints the result
Loop — waits for the next input
// Start REPL by typing 'node' in terminal
// Then you can run expressions:
// > 2 + 3
// 5
// > const arr = [1, 2, 3];
// > arr.map(x => x * 2)
// [2, 4, 6]
// > .help // shows available commands
// > .exit // exits the REPLThis shows typical REPL usage. You enter JavaScript expressions and immediately see results.
The underscore variable (_) holds the result of the last expression. Dot commands like .help and .exit provide REPL-specific functionality.
This is a straightforward question. Keep the answer concise.
Mention what REPL stands for, its use cases, and the dot commands. No need to over-explain.