Is nodejs the same as js?

青灯夜游
Release: 2021-10-29 15:32:04
Original
4365 people have browsed it

Nodejs is different from js. The difference between the two: 1. Nodejs is a platform, while js is a programming language; 2. The top-level objects are different. The top-level object in JS is the window object, and the top-level object in node is the global object; 3. The composition of nodejs and js is different.

Is nodejs the same as js?

The operating environment of this tutorial: windows7 system, nodejs version 12.19.0&&javascript1.8.5, Dell G3 computer.

nodejs and js are different.

Node.js is a JavaScript running environment based on the Chrome V8 engine. It is a development platform that allows JavaScript to run on the server side. It allows JavaScript to become a server-side language like PHP, Python, Perl, Ruby, etc. An equal scripting language.

JavaScript is a literal scripting language, a dynamically typed, weakly typed, prototype-based language. js (JavaScript) is a high-level, interpreted programming language; it is a prototype-based, function-first language, and a multi-paradigm language that supports object-oriented programming, imperative programming, and functional programming. .

Traditional js runs on the browser, because the browser core is divided into two parts:

  • Rendering engine---rendering HTML and CSS
  • JavaScript engine---responsible for running JavaScript

If you want to execute JavaScript code, you need a js engine. You can install a browser (built-in js engine), or a nodejs environment (built-in js engine), If you call the API provided by the browser in the js code, you must install a browser. If you call the nodejs API, you must install the nodejs environment, and then load and execute the JavaScript code in the respective prescribed ways.

The difference between node.js and js:

1. node.js is Platform, JS is a programming language;

2. JS is a client programming language, which requires the browser's JavaScript interpreter to interpret and execute;

3. node.js is a platform based on the Chrome JavaScript runtime. It is a running environment that encapsulates the Google V8 engine;

4. node.js is the browser The interpreter of the server is encapsulated as a server running platform, programmed with a JavaScript-like structural syntax, and runs on node.js.

5. The composition of node.js and js is different:

JavaScript:

  • ECMAScript (language basis, Such as: syntax, data type structure and some built-in objects)

  • DOM (some methods to operate page elements)

  • BOM (some operations to browse Converter methods)

Node.js:

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

  • OS (operating system)

  • file (file system)

  • net (network system)

  • database(database)

6. The top-level objects are different

The top-level object in JS The object is a window object, but there is no window object in node. The top-level object in node is a global object. This is the difference between the two.

In the window object, defining a global variable can be accessed through Window, but it cannot be accessed through the global object in node

[Recommended learning: "nodejs Tutorial》】

The above is the detailed content of Is nodejs the same as js?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!