Node.js comes with virtual environment called REPL (aka Node shell). The repl module provides a Read-Eval-Print-Loop implementation that is available both as a standalone program or includible in other applications. It can be accessed using: const repl = require(‘repl’); It is a quick and easy way to test simple Node.js/JavaScript code.
- R(Read) : Reads user’s input, parses the input into JavaScript data-structure, and stores in memory
- E(Eval) : Takes and evaluates the data structure.
- P(Print) : Prints the result.
- L(Loop) : Loops the above command until the user presses ctrl-c twice
To launch the REPL (Node shell), open 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-
You can execute an external JavaScript file by writing node fileName command.
Please visit to https://nodejs.org/api/repl.html#repl_repl for more and deep info 🙂
Programming is Easy…
Advertisements
Nice article and great examples!
Thanks for sharing it.
(and nice blog too 😉 )
LikeLiked by 1 person