The Node.js REPL is an interactive environment that allows you to execute JavaScript code line by line and immediately see the output.
Read – Reads the user input
Eval – Evaluates the JavaScript code
Print – Displays the result
Loop – Waits for the next command
Open a terminal and type:
You will see:
| Command | Description |
|---|---|
.help | List all REPL commands |
.exit | Exit the REPL |
.clear | Clear the context |
.save file.js | Save session to a file |
.load file.js | Load a file into REPL |
You can directly access:
console
process
global
__dirname
__filename
Fast testing and debugging
No file creation required
Ideal for learning and experimentation
Not suitable for large applications
Session data is lost on exit
Testing small code snippets
Debugging logic
Exploring Node.js APIs
Take quizzes related to this topic and see where you stand!
Start Quiz Now