DEV Community

Shubham Gupta
Shubham Gupta

Posted on

# REPL in node.js

REPL is nothing but a virtual environment. The job of REPL is to test a simple node and javascript code. Like another programming language, for example, java spring boot for the simple test application you have to create a whole project but with node.js with the help of REPL you can perform the quick operation without creating any project. You can start the REPL environment by just typing the node on the shell, REPL stands for Read_Eval_Print_Loop, which means.

R -> READ = Read a user input
E -> Evaluate = Evaluate user input
P -> Print = Print Output(Result)
L -> Loop = Wait for new input
Enter fullscreen mode Exit fullscreen mode

open command prompt or terminal (in Window or Mac or UNIX/Linux) and type node.

Please Reload

you can do many operations using variables and different types of expressions.

Simple Expression:- A simple addition, subtraction, multiplication, division you can do in the console. for example - enter 4 + 3 it will give you a result 7. All normal expression you can don in REPL

Please Reload

Multiline Expression:- You can mention conditions and statements or function inside the terminal and perform different operations. Node REPL also supports loops and multiline expressions. as shown below

Please Reload

Use of Variable:- You can also declare a variable in the console. The variable allows you to store the value into variable to print the value of the variable you can simply console it with the help of console.log()

Please Reload

You can read more about REPL from official docs. click here

Medium article click here

Medium Profile
°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

Top comments (0)