Home >> Tutorials >> Nodejs - REPL
Node.js REPL (Read Eval Print Loop)

In node.js, REPL is a run-time environment and it is similar to Shell or command prompt in Linux or windows machines. The REPL stands for Read-Eval-Print-Loop and it is very useful when we want to test a simple JavaScript or node.js code snippets.

Suppose, if we install a node.js in our machine, then automatically the REPL runtime environment also get installed because by default the node.js will contain a REPL module and it is also called as "Nodejs Interactive Window".

TypeDescription
Read It reads the input statements provided by user, parse it to JavaScript data structure, and stores it in memory for further operations.
Eval It will evaluate the parsed JavaScript data structure and return the result.
Print Whenever the result is ready, then it will print the result.
Loop Loops the input command until we press Ctrl + C twice to exit from REPL.
Node.js REPL Commands
CommandDescription
.help It will display all the available commands in REPL terminal.
.break It will make exit from multiline expression.
.clear It will make exit from multiline expression.
CTRL + C It will terminate the current command.
CTRL + C (Twice) It will terminate / close the node.js REPL terminal.
CTRL + D It will terminate / close the node.js REPL terminal.
tab key It will list all the available commands in REPL.
Up/Down Keys It will show the previous commands applied in REPL.
.save filename It will save the current node.js REPL session to the file.
.load filename It will load the specified file content to current node.js REPL session.