Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Is nodejs the same as js?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "is nodejs the same as js". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "is nodejs the same as js?"

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

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

Nodejs is different from js.

Node.js is a JavaScript running environment based on Chrome V8 engine and a development platform for JavaScript to run on the server side. It makes JavaScript a scripting language on a par with server-side languages such as PHP, Python, Perl, Ruby and so on.

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

Traditional js runs on browsers because the browser kernel 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 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 nodejs API, you must install the nodejs environment, and then load and execute JavaScript code in their own way.

The difference between node.js and js:

1. Node.js is the platform and Js is the programming language

2. Js is a client-side programming language, which needs to be interpreted and executed by the browser's JavaScript interpreter

3. Node.js is a platform based on Chrome JavaScript runtime, which encapsulates the Google V8 engine.

4. Node.js encapsulates the interpreter of the browser as a server running platform, programs with a structural syntax similar to JavaScript, and runs on node.js.

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

JavaScript:

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

DOM (some ways to manipulate page elements)

BOM (some ways to manipulate browsers)

Node.js:

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

OS (operating system)

File (file system)

Net (Network system)

Database (database)

6. Different top-level objects

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

Defining a global variable is accessible through Window in the window object, but not through the global object in node

Thank you for your reading, the above is the content of "nodejs is the same as js", after the study of this article, I believe you have a deeper understanding of the problem of nodejs and js, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report