[3.1] Node.js Developer's Guide BYVoid start using Node.js programming

3.1.1 Hello World

 

Open vscode, input console.log ( "helloworld");

New Save the file named helloworld.js

Open a terminal, go to the directory where helloword.js (shift + right-blank, open a command line here) , execution node helloworld.js

 

 

Common output command

console.log

console.error

 

console.log is the most frequently used instructions, and printf function similar to the C language, accept any number of parameters may be, supports% d% s references to variables

 

 

 

3.12 Node.js command-line tool

node --help Help

 

 

The basic method of operation node.js: directly run the script

Execution node script.js

(Script.js is the file name of the script)

 

 

Another way to output Hello World:

The statement to be executed, direct execution as a parameter of node -e

Guess you like

Origin www.cnblogs.com/jane-panyiyun/p/12113891.html