91-9990449935 0120-4256464 |
Node.js REPLThe term REPL stands for Read Eval Print and Loop. It specifies a computer environment like a window console or a Unix/Linux shell where you can enter the commands and the system responds with an output in an interactive mode. REPL EnvironmentThe Node.js or node come bundled with REPL environment. Each part of the REPL environment has a specific work. Read: It reads user's input; parse the input into JavaScript data-structure and stores in memory. Eval: It takes and evaluates the data structure. Print: It prints the result. Loop: It loops the above command until user press ctrl-c twice. How to start REPLYou can start REPL by simply running "node" on the command prompt. See this: You can execute various mathematical operations on REPL Node.js command prompt: Node.js Simple expressionsAfter starting REPL node command prompt put any mathematical expression: Using variableVariables are used to store values and print later. If you don't use var keyword then value is stored in the variable and printed whereas if var keyword is used then value is stored but not printed. You can print variables using console.log(). Example: Node.js Multiline expressionsNode REPL supports multiline expressions like JavaScript. See the following do-while loop example: Node.js Underscore VariableYou can also use underscore _ to get the last result. Example: Node.js REPL Commands
Node.js Exit REPLUse ctrl + c command twice to come out of Node.js REPL.
Next TopicNode.js Package Manager
|