Running environment: 1. Browser running environment. JavaScript in the browser environment mainly consists of three parts: ECMAScript, DOM and BOM; 2. "Node.js" running environment, "node.js" uses ECMAScript As a basis, JavaScript can be run on the server side.
The operating environment of this tutorial: Windows 10 system, JavaScript version 1.8.5, Dell G3 computer.
JavaScript has two running environments:
One is the browser running environment
One is the Node.js running environment
Browser running environment
JavaScript in the browser environment mainly consists of three It is composed of ECMAScript, DOM and BOM.
JavaScript was born with the birth of the browser, so JavaScript execution is still within the browser environment at most. However, the concept of JavaScript as a server-side script has been around since its birth. In 1995, Netscape proposed the concept of server-side JavaScript and developed Netscape Enterprise Server; in 1996, JScript released by Microsoft can also run on the server side.
JavaScript does not run directly on the operating system after compilation and other compiled languages such as C language. Because it is a scripting language, it must be run with the help of an engine (interpreter), so it can be run on the operating system. Run in an environment that encapsulates the engine. The environment that encapsulates the JavaScript engine can be divided into two categories: one is the browser environment; the other is the non-browser environment, such as Node.js and MongoDB.
Node.js running environment
Node.js is based on ECMAScript and extends I/O operations, file operations, database operations, etc.
JavaScript is defined as a browser scripting language. Its running environment has always been the client browser, because the original intention of JavaScript design is to do some interaction between the browser and the user and some special effects on the web page. Complement the deficiencies of HTML and CSS.
In 2009, node.js technology was born. node.js is a Javascript runtime environment (runtime). In fact, it encapsulates the Google V8 engine. Node.js is a platform based on the Chrome JavaScript runtime, which is used to easily build web applications with fast response speed and easy expansion.
node.js enables JavaScript to run on the server side as a server scripting language, similar to dynamic languages such as php.
【Related recommendations: javascript video tutorial, web front-end】
The above is the detailed content of In what environments can javascript run?. For more information, please follow other related articles on the PHP Chinese website!