Node.js is a javascript runtime environment based on Chrome V8 engine.
Node.js is not a new language. Node.js is not a library or framework. Node.js is a JavaScript runtime environment. Node.js can parse and execute JavaScript code. Previously, only browsers could parse and execute JavaScript code. Now JavaScript can be executed completely without the browser, thanks to Node.js
JavaScript in the browser
EcmaScript: basic SYNTAX rules of JS, such as if, var, function, Object, and Array BOM DOM
In the node. Js JavaScript
Node, which has no BOM, DOM EcmaScript syntax, provides some server-side manipulation apis for JavaScript in the JavaScript execution environment
- Read and write files
- Construction of network services
- Network communication
- The HTTP server
Built on Chrome’s V8 IQ
- The code is just a string with a particular format
- The engine can understand it, the engine can help you parse and implement it
- Google Chrome’s V8 engine is currently the fastest parsing execution of JavaScript code by workers
- The authors of Node.js have ported the V8 engine from Google Chrome and developed a separate JavaScript runtime environment.
The characteristics of the node. Js
Event-driven Non-blocking I/O model (asynchronous) Lightweight and efficient
Node.js has an entire ecosystem
NPM is the largest open source ecosystem in the world. Most javascripts related packages are stored in NPM, which makes it easier for developers to download and use such as NPM install jquery
What can Node.js do
Web server backend development command line tool NPM Hexo
The installation of the Node. Js
// Check the current node version on your computer
node --version
Copy the code
Node download address
nodejs.org/en/
Node executes js files
Create a helloworld.js file
var hello = 'Hello World'
console.log(hello)
Copy the code
node helloworld.js
Copy the code
The execution result