You are here: Home / Topics / Node.js - REPL Terminal

Node.js - REPL Terminal

Filed under: NodeJs on 2024-02-22 20:38:39

REPL stands for Read Eval Print Loop and it represents a computer environment like a Windows console or Unix/Linux shell where a
command is entered and the system responds with an output in an interactive mode. Node.js or Node comes bundled with a REPL
environment. It performs the following tasks −

Read − Reads user's input, parses the input into JavaScript datastructure, and stores in memory.
Eval − Takes and evaluates the data structure.
Print − Prints the result.
Loop − Loops the above command until the user presses ctrl- c twice.

The REPL feature of Node is very useful in experimenting with Node.js codes and to debug JavaScript codes.

Starting REPL:

REPL can be started by simply running node on shell/console without any arguments as follows.
$ node
You will see the REPL Command prompt > where you can type any
Node.js command −
$ node
Simple Expression
Let's try a simple mathematics at the Node.js REPL command prompt −
$ node
> 1 + 3
> 1 + ( 2 * 3 ) - 4

About Author:
Team MCQ Buddy     View Profile
Hi, I am using MCQ Buddy. I love to share content on this website.