node REPL
The REPL is an interactive prompt where you type JavaScript and see the result immediately.
In this page:
Syntax
$ node
> expression
node REPL
Running node with no arguments starts the Read-Eval-Print Loop. Each expression is evaluated and its result printed. Special commands begin with a dot, such as .help, .editor and .exit, and the underscore variable holds the last result.
Note:
Press Ctrl+D or type .exit to leave the REPL.
Example: node REPL
$ node
> 2 + 3
5
> const name = "Ada"
undefined
> `Hello, ${name}`
'Hello, Ada'
> _
'Hello, Ada'
> .exit
⚠️ Run this in your own terminal or Node.js environment.
Related Topics
Common Mistakes
- Forgetting the dot before REPL commands
- Expecting variables to persist after exiting
- Pasting multi-line code without .editor mode
Chapter Summary
- node starts the REPL
- Results print automatically
- _ holds the last result
- Commands start with a dot
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: