Node common operation commands

Enter REPL environment (READ EVAL PRINT LOOP)

  1. receive user input
  2. perform user input
  3. print the execution result to the console
  4. loop to next time

Open the terminal, type node to enter the command interactive mode, you can enter a code statement and execute it immediately and display the result, for example:

$ node
> console.log('Hello World!');
Hello World!

Exit the REPL environment

.exit

Use strict mode (define before use)

node --use_strict

 

The special variable _ indicates the return result of the previous command

Exit command interaction

process.exit()

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325016551&siteId=291194637