Difference: 1. Javascript is a web front-end language, while Node is a platform that can quickly build network services and applications. 2. Javascript mainly applies to the front end and is used for web development; while Node mainly applies to the back end and is used to build servers at the back end.
The operating environment of this tutorial: windows7 system, nodejs version 14.15.4&&javascript1.8.5, Dell G3 computer.
What is node.js?
Node.js is a Javascript runtime environment (runtime).
What is the difference between Node.js and JavaScript?
Essence:
Javascript is a web front-end language, mainly used in web development, and is parsed and executed by the browser
Node.js is a platform that can quickly build network services and applications. It is a service platform built with Javascript language and can be used to build servers on the back end.
Difference:
Javascript | The main application front-end | is the programming language | Client programming language (requires browser JavaScript interpreter for interpretation and execution) |
node.js | The main application backend | is a platform | run Environment (a platform based on the Chrome JavaScript runtime, which is a running environment that encapsulates the Google V8 engine) |
Simply speaking, node.js is the browser The interpreter is encapsulated as a server running platform, programmed with a JavaScript-like structural syntax, and runs on node.js.
Advantages of Node.js? Disadvantages of Node.js?
Advantages:
1. Event-driven
2.Asynchronous programming
3 . Non-blocking mode IO
4. Lightweight and efficient
Disadvantages:
1. Low reliability
2. Single process, single thread, only supports single-core CPU, and cannot fully utilize multi-core CPU servers. Once this process crashes, the entire web service crashes.
What are the applicable scenarios for Node.js? Scenarios where Node.js is not applicable?
Applicable scenarios:
1.JSON APIL - Build a Rest/JSON API service, node.js can give full play to Its non-blocking IO model and JavaScript functional support for JSON. [Recommended learning: "nodejs Tutorial"]
2. Single page, multiple Ajax request applications - there are a large number of asynchronous requests on the front end, which requires extremely high response speed on the server backend
3. Develop Unix command line tools based on node.js - node.js can generate a large number of child processes and output them in a streaming manner
4. Streaming data - traditional web applications , HTTP requests and responses are usually regarded as atomic events. And node.js will make full use of the characteristics of streaming data to build very cool applications
Not applicable scenarios:
Heavy CPU usage, io Lightly used applications
For more programming-related knowledge, please visit: Programming Video! !
The above is the detailed content of What is the difference between node and JavaScript?. For more information, please follow other related articles on the PHP Chinese website!