Node js REPL

Node.js comes with node shell to write and print commands, it is called REPL (Read-Eval-Print-Loop). REPL provides a computer environment like a window console or a UNIX/Linux shell, where we can execute Node.js/Javascript code.


REPL stands for

Read - Read the user's input and store in memory.
Eval - Evaluates the data structure.
Print - Prints the result.
Loop - Loops the given command until someone press ctrl+c.


Start REPL Window

To start REPL window, open cmd and simply type node or go to start and search for Node.js icon and click to launch the REPL window.


Expression Continuity

Node.js REPL automatically check for multiline expression. For multiline expression, just press has entered to write in next line. REPL displays three dots (...). This means we can write next line code here.

REPL Commands


ctrl+c - Used to terminate the current command.
nodejs termination

ctrl+c double - Used to terminate the Node REPL.

ctrl+d - Used to terminate the Node REPL.

break - Used to get out of the multiline expression.
nodejs break

help - Used to list all commands.
nodejs help

load - Used to load file contents in current REPL Session.
nodejs load

save - Used to save the current REPL session to a file.
nodejs save

tab Keys - list of current commands.
nodejs tab keys



Read more articles


General Knowledge



Learn Popular Language