1. Introduction
1. What is Node.js
Simply put, Node.js is JavaScript running on the server.
Node.js is an event-driven I/O server-side JavaScript environment. Based on Google's V8 engine, the V8 engine executes Javascript very fast and flexible. Can be very good
2. What is the use of Node.js
If you are a front-end programmer and you don't know dynamic programming languages like PHP, Python or Ruby, and you want to create your own services, then Node.js is a very good choice.
Node.js is JavaScript running on the server. If you are familiar with Javascript, then you will easily learn Node.js.
Of course, if you are a back-end programmer and want to deploy some high-performance services, then learning Node.js is also a very good choice.
Two, installation
1. Download
Official website: https://nodejs.org/en/
Chinese website: http://nodejs.cn/
LTS: Long-term support version
Current: The latest version
2. Installation
3. Check the version
node -v
Three, quick start
1. Create folder nodejs
2. Console program
Create 01-console program.js
console.log('Hello Node.js')
Open the command line terminal: Ctrl + Shift + y
enter the directory where the program is located, enter
node 01-控制台程序.js
The browser's kernel includes two cores:
DOM rendering engine;
js parser (js engine)
js runs inside the js engine in the kernel of the browser
Node.js is a JavaScript program that runs out of the browser environment, based on the V8 engine (Chrome's JavaScript engine)
Use node.js in vscode
Right-click in the js file and select Open in the integrated terminal to open the terminal page, and then you can enter in it
node +js文件名 进行运行