Node JS - Node js - REPL Features - Node - Node JS tutorial - webnode
What is REPL features?
- 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.
Press Ctrl+C :
- Terminates the current command’s execution.
Press Ctrl + C two times :
- Returns back the control from REPL to the normal command prompt.
Press Ctrl+D :
- Exit the REPL window.
Pressing up and down arrow keys :
- Helps to navigate across command history and choose previous commands. This enables to avoid typing the commands again and again.
Press tab key :
- If you type a single character and then followed by tab it will Displays a list of current commands, functions, and variables starting with that specific character as shown below:
Learn Nodejs - Nodejs tutorial - nodejs command window - Nodejs examples - Nodejs programs
- The REPL can handle multiline expression such as (1 + 2) * (3 + 4)The REPL provides a special variable _ (underscore) to fetch the result of the last expression as shown below:
Learn Nodejs - Nodejs tutorial - nodejs repl expressions - Nodejs examples - Nodejs programs
- Addition operation is happening and the result is given on giving x+y and press enter keyword. The result is displayed as 12.
- Now enter underscore ( _ ) and press enter key, it shows the previous manipulated result, that is 12.