Node REPL (Read-Eval-Print Loop)

A Read-Eval-Print Loop (REPL) is a simple, interactive computer programming environment.

The Node REPL provides a way to interactively run JavaScript and see the results. It can be used for debugging, testing, or just trying things out.By executing node without any arguments from the command-line you will be dropped into the REPL. It has simplistic emacs line-editing.

  1. A read function, which accepts an expression from the user and parse it into a data structure in memory .

  2. An eval function, which takes the data structure and evaluates.

  3. A print function, which prints the result.

  4. A loop function, which runs the above three commands until termination

> dileep@dileep-google:~$ node

> 1 + 2


> 1 + 2 – 3


> 1 +(3-2)*4/2



Example: List of current commands

Press tab key to see the list of current commands.

> function hi() {console.log(“Hello, World!”);};


> hi

[Function: hi]

> hi()

Hello, World!


> hi)(

Hello, World!


And the problem was because, REPL encloses the statements with parens. So




Actual explanation can be found here

REPL Features

  1. Press Ctrl+C to terminate the current command.
  2. Pressing Ctrl + C twice causes the REPL to quit.
  3. Press Ctrl+D to exit the REPL.
  4. Pressing up and down arrow keys you can see command history and modify previous commands.
  5. Press tab key to see the list of current commands. If you type a single character followed by tab it will show the list of keywords, functions, and variables starting with that particular character.
  6. The REPL can handle multiline expression.
  7. The REPL provides a special variable _ (underscore) which is used to pull the result of the last expression.
  8.  To instruct the Node.js process to exit:       process.exit() Or to exit by keyboard interrupt, press CTRL+C twice.

More Information on REPL : REPL


My Name is Dileep Singh, Noder, Javascript Lover & NoSql Developer, Fitness Freak, Love to travel new places, learning photography & Music Manic ♯ ♩ ♬

Posted in Node.Js Tagged with: ,