What is the difference between JS and node. js? Summary of similarities and differences between JS and node. js

Source: Internet
Author: User
About the difference between node. js and JavaScript, you know? Do you know about the similarities between node. js and JavaScript? If you do not know, then don't come to see this article, you are still waiting for what, see now

First, let's look at the comparison between JS and node. JS:

Javascript:

ECMAScript (language basics such as syntax, data type structure, and some built-in objects)

DOM (Some ways to manipulate page elements)

BOM (some ways to manipulate the browser)

The above is part of JavaScript, so what about Nodejs?

Nodejs:

ECMAScript (language basics such as syntax, data type structure, and some built-in objects)

OS (operating system)

File (filesystem)

NET (network system)

Database (DB)

Analysis: It is easy to see that the front-end and the back-end of the JS the same point is that their language base is ECMAScript, but they expand the things different, the front-end needs to manipulate the page elements, and then expand the DOM, also need to operate the browser, so it expands the BOM. And the service side of the JS is also based on the ECMAScript extension of the service side of the need for some API, a little understanding of the background of children's shoes certainly know that the background voice has the ability of the operating system, so the expansion of the OS, need to have the ability to manipulate files, so expand the file system, need to operate the network, So expand the net network system, need to manipulate the data, so to expand the ability of database.

Such a contrast, I believe many small partners to nodejs more understanding, the original front end and the service side of JS so similar, their foundation is the same, but the environment is different, resulting in their expansion of something different. (Want to see more on the Topic.alibabacloud.comnode.js Video tutorial section to learn, watching video can also learn)

The similarities and differences between JS and node. JS are summarized:

JavaScript consists of: ECMAScript (the basis for defining the language, such as syntax, data type, structure, and some built-in objects, etc.), DOM (based on ECMAScript, extended methods for manipulating page elements), BOM (based on ECMAScript, Extension of some of the methods used to manipulate the browser).

Nodejs is based on ECMAScript, and then expands on this basis some of the other things (that is, operation of non-browser) some methods, such as operating OS operating system, file filesystem, net network, database databases and so on. That is to say Nodejs and JS at the bottom are the same, are ECMAScript, but the expansion of the function is not the same. One is biased towards the front-end browser, and one is biased towards the backend.

In the ECMAScript section node and JS are actually the same, such as with the definition of data type, syntax structure, built-in objects. But the top-level object in JS is the Window object, but there is no window object in node, and the top-level object in node is the global object. This is the difference between the two.

Third, there are some very easy to see the difference:

    • JavaScript is a language

    • node. JS is not a language, nor is it a special JavaScript dialect-it's just something to run common JavaScript code

    • All browsers have JavaScript engines that run JavaScript on the web. Firefox has an engine called SpiderMonkey, Safari has javascriptcore,chrome V8

    • node. JS is the V8 engine with the ability to manipulate I/O and the network library, so you can use JavaScript to create shell scripts and background services outside the browser or to run on hardware

    • JavaScript is a web front-end language that is used primarily for web development and is performed by browser parsing

    • node. JS is a platform for quickly building network services and applications, a service platform built in JavaScript language that can be used to build servers in the backend

They all use the JS syntax, the former main application of the front end of the main application and back-end

    • The difference between node. js and JavaScript is quite large, 1 platforms, one is programming language;

    • JavaScript is a client-side programming language that requires the browser's JavaScript interpreter to perform the interpretation;

    • node. JS is a platform built on the chrome JavaScript runtime, which encapsulates the Google V8 engine's running environment;

    • To put it simply, node. JS is encapsulating the browser's interpreter as a server running platform, programmed with JavaScript-like structure syntax and running on node. js.

These are the differences and similarities and differences between this article about node. js and JS (want to learn more about the Topic.alibabacloud.comnode.js Chinese Reference Manual column). The full text is easy to understand, the problem can be in the bottom message.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.