Javascript and Node.js relationship

 

Traditionally, Javascript is composed of ECMAScript , Document Object Model ( DOM ), Browser Object Model ( BOM ), while Mozilla states that Javascript is composed of Core Javascript and Client Javascript .

 

NodeJs is a platform that allows Javascript to run outside the browser. The Javascript referred to here is just Core Javascript , or an implementation of ECMAScript . It implements functions such as file system, modules, packages, operating system API , network communication, etc. that Core Javascript does not have or is not perfect.

 

The Javascript engine of NodeJs is V8 , which comes from the google chrome project. V8 claims to be the fastest Javascript engine in the world.

 

Node.js does not run in the browser, so there is no browser compatibility issue with Javascript, and you can use all the features of the Javascript language with confidence.

 

Javascript is for the client, Node.js is for the web.

 

With Node.js you can develop:

Website with complex logic

Large-scale web applications based on social networks

WebSocket server

TCP/UDP socket application

command line tool

interactive terminal program

Native application with graphical user interface

unit testing tool

Client side Javascript compiler

 

  

NodeJS has a built-in HTTP server, which means that you can easily implement a combination of a website and a server, which is different from PHP and Perl , because when using PHP , you must first build an HTTP server such as Apache , and then use HTTP The server's module loading or CGI call can present the execution result of the PHP script to the user. And when you use NodeJs , you don't need to build an additional HTTP server, because NodeJs itself has one built-in. Not only can this server be used to test the code, but it can itself be deployed to a production environment, and its performance is good enough.

 

        

Standardized - ECMAScript

Initially , Javascript did not have a standard, so there were various compatibility issues between different browsers. In 1996 , the Javascript standard was jointly submitted by many software manufacturers to ECMA (European Computer Manufacturers Association), and ECMA passed the standard. ECMA-262 , also known as ECMAScript .

 

CommonJS specification

In order to unify the implementation of Javascript outside the browser, CommonJS was born. CommonJS attempts to define a set of APIs used by common applications , thereby filling the shortcomings of the Javascript standard library that is too simple. The ultimate goal of CommonJS is to have a specification like the C++ standard library.

 

 

 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326169296&siteId=291194637