JavaScript can be executed on the server side; nodejs can be used to execute JavaScript on the server side, because nodejs is a JavaScript running environment based on the "Chrome V8" engine and is a development platform that allows JavaScript to run on the server side.
The operating environment of this tutorial: Windows 10 system, JavaScript version 1.8.5, Dell G3 computer.
NodeJS, simply put, it is actually JavaScript running on the server side.
The following is a detailed introduction:
Nodejs is a JavaScript running environment based on the Chrome V8 engine, a development platform that allows JavaScript to run on the server
JS is a scripting language and requires a parser to run. For JS written in HTML pages, the browser acts as a parser. For JS that needs to run independently, NodeJS is a parser.
Each parser is a running environment, which not only allows JS to define various data structures and perform various calculations, but also allows JS to do some things using the built-in objects and methods provided by the running environment. For example, the purpose of JS running in the browser is to manipulate the DOM, and the browser provides built-in objects such as document. The purpose of JS running in NodeJS is to operate disk files or build HTTP servers. NodeJS accordingly provides built-in objects such as fs and http.
Node.js is an indispensable tool for front-end workers. In particular, JavaScript has been greatly improved, and the application of Node.js has been developing very vigorously at this stage. It is essential to learn and use Node.js proficiently!
Currently, Node.js has a place in most fields, especially I/O-intensive ones.
Such as web development, microservices, front-end construction, etc. Many large websites use Node.js as the backend development language. The most commonly used ones are Node.js for front-end rendering and architecture optimization, such as Taobao's Double Eleven, Qunar.com's PC-side core business, etc.
In addition, many well-known front-end libraries are also developed using Node.js. For example, Webpack is a powerful packager, and React/Vue is a mature front-end component framework.
Node.js is usually used to develop low-latency network applications, that is, those applications that require real-time collection and exchange of data between the server-side environment and the front-end (API, instant chat, microservices). Alibaba, Tencent, Qunar, Baidu, PayPal, Dow Jones, Walmart and LinkedIn all use the Node.js framework to build applications.
Related recommendations: javascript learning tutorial
The above is the detailed content of Can javascript be executed on the server side?. For more information, please follow other related articles on the PHP Chinese website!