Home >Web Front-end >JS Tutorial >Detailed explanation of the usage of interactive interpreter in Node.js

Detailed explanation of the usage of interactive interpreter in Node.js

巴扎黑
巴扎黑Original
2017-08-08 10:28:491825browse

This article mainly introduces relevant information about Node.js REPL (interactive interpreter) examples. Node.js REPL (Read Eval Print Loop: interactive interpreter) represents a computer environment, similar to that of Window system Terminal, we can enter commands in the terminal and receive the system's response. Friends in need can refer to

Node.js REPL (interactive interpreter) example detailed explanation

Node.js REPL (Read Eval Print Loop: interactive interpreter) represents a computer environment, similar to the terminal of the Window system. We can enter commands in the terminal and receive the system's response.

Node comes with an interactive interpreter that can perform the following tasks:

  • Read-read user input, parse the input Javascript data structure and stored in memory.

  • Execution - Execute the input data structure

  • Print - Output the result

  • Loop - Loop Operate the above steps until the user presses the ctrl-c button twice to exit.

Multi-line expression

##Underscore (_) variable

You can use the underscore (_) to get the result of an expression:


REPL Command

  • ctrl + c - Exit the current terminal.

  • ctrl + c pressed twice - Exit Node REPL.

  • ctrl + d - Exit Node REPL.

  • Up/Down keys - View the history of entered commands

  • tab key - List current commands

  • .help - List used commands

  • .break - Exit multi-line expression Expression

  • .clear - Exits the multi-line expression

  • .save filename - Saves the current Node REPL session to the specified file

  • .load filename - Load the file contents of the current Node REPL session.

The above is the detailed content of Detailed explanation of the usage of interactive interpreter in Node.js. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn