Learn Simpli

Free Online Tutorial For Programmers, Contains a Solution For Question in Programming. Quizzes and Practice / Company / Test interview Questions.

Read Eval Print Loop (REPL) in nodeJS

Introduction
  1. The repl module provides a Read-Eval-Print-Loop (REPL) implementation that is available both as a standalone program or includible in other applications
  2. The repl module exports the repl.REPLServer class
  3. Accept individual lines of user input
  4. Evaluate those according to a user-defined evaluation function, then output the result
  5. Input and output may be from stdin and stdout, respectively, or may be connected to any Node.js stream
How to run
  1. Open terminal and type node
  2. This will take you repl mode
> 1 + 1
2
> const x = 2
undefined
> x + 1
3