Node.js - REPL Terminal
- Eval− Takes and evaluates the data structure.
- Print− Prints the result.
- Loop− Loops the above command until the user presses ctrl-c
To launch the REPL (NODE shell), open the command prompt(in windows) or terminal(in mac or UNIX/LINUX) and type node as shown below. It will change the prompt to > in windows and MAC.
For example, if you write "10 + 20" then it will display the result 30 immediately in new line.
You can also define variables and perform some operation on them.
- You can execute node node-example.js from a command prompt as shown below
- To exit from the REPL terminal, press Ctrl + C twice or write .exit and press Enter.
Important REPL commands are as follows: