REPL stands for Read Eval Print Loop. It basically represents a computer environment like Linux/Unix terminal, window console, etc.
It comes with a Nodejs package so you do not need to install it separately.
firstly open the terminal
run the node command
$ node
now You will see the REPL Command prompt > where you can type any Node.js command
$ node
>
// Add the two string
> "John"+" "+"Roser"
John Roser
// Add the numeric value
>1+2+4
7
Note:- to terminate the command we use ctrl+c
What is REPL – Interview Questions
Q 1: What is REPL?
Ans: REPL stands for Read-Eval-Print Loop.
Q 2: Why is REPL used?
Ans: For quick testing and debugging JavaScript code.
Q 3: How do you start REPL?
Ans: By typing node in the terminal.
Q 4: Can variables be defined in REPL?
Ans: Yes, variables and functions can be defined.
Q 5: How do you exit REPL?
Ans: Use .exit or press Ctrl + C twice.