Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the differences between node.js and javascript

Shulou Source: shulou.com Published: 2022-06-03 03:50:22 10月17日 Update

This article mainly introduces the differences between node.js and javascript, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Differences: 1, JavaScript is a scripting language, while Node.js is a development platform that allows JavaScript to run on the server; 2, JS is biased towards the front-end browser, node is biased towards the back-end; 3, the top-level object in JS is the window object, while the top-level object in node is the global object.

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

JavaScript is an advanced, interpretive, literal scripting language. It is a prototype-based, function-oriented scripting language. It has been widely used in Web application development, often used to add a variety of dynamic functions to web pages, and provide users with more smooth and beautiful browsing effects.

Node.js is a JavaScript running environment based on Chrome V8 engine and a development platform that allows JavaScript to run on the server side.

The difference between node.js and javascript:

1. JavaScript is a scripting language, while Node.js is a development platform that allows JavaScript to run on the server.

2. Nodejs and JS are the same at the bottom, both are Ecmascript, but the extended functions are different. One is biased towards the front-end browser and the other is biased towards the back-end.

3. Different top-level objects

In the Ecmascript section, node and JS are actually the same, such as the definition of data types, syntax structures, and built-in objects. But 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.

In the window object, defining a global variable is accessible through Window, but not in node through the global object, such as:

Var axiom 100th console.log (global.a)

In this way, the output result is:

Undefined

For the above example, because the variable defined in node is an object in the module, not a global global variable, the result is undefined.

Thank you for reading this article carefully. I hope the article "what is the difference between node.js and javascript" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Object top-level article script language development run variable platform development platform end service browsing global front-end function is in browser environment result Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Microsoft Shulou Tech Info Apple Shulou Information