loading...

# REPL in node.js

shubhamggupta profile image Shubham Gupta ・2 min read

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

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
°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°

Posted on May 18 by:

shubhamggupta profile

Shubham Gupta

@shubhamggupta

Core Java, Android Dev, Node Js, RESTFul API, Angular, Google Cloud(App Engine, Kubernetes, Docker), Postgresql, MySql

Discussion

markdown guide