Enter REPL environment (READ EVAL PRINT LOOP)
- receive user input
- perform user input
- print the execution result to the console
- 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()