JavaScript is not a server-side scripting language, but a client-side scripting language; JavaScript is a scripting language whose source code does not need to be compiled before being sent to the client for running, and does not require server-side support. It is an interpreted scripting language; it can Use nodejs to achieve the effect of JavaScript running on the server side.
The operating environment of this tutorial: Windows 10 system, JavaScript version 1.8.5, Dell G3 computer.
JavaScript is not a server-side scripting language. JavaScript is a client-side scripting language. It does not require server support. It is an interpreted scripting language and is mainly used on the client.
JavaScript is a scripting language whose source code does not need to be compiled before being sent to the client for execution. Instead, character codes in text format are sent to the browser for interpretation and execution by the browser.
JavaScript scripting language has the following characteristics:
(1) Scripting language.
JavaScript is an interpreted scripting language. Languages such as C and C++ are compiled first and then executed, while JavaScript is interpreted line by line during the running of the program.
(2) Based on objects.
JavaScript is an object-based scripting language that can not only create objects but also use existing objects.
(3)Simple.
The JavaScript language uses weakly typed variable types and does not impose strict requirements on the data types used. It is a scripting language based on Java's basic statements and controls, and its design is simple and compact.
(4)Dynamic.
JavaScript is an event-driven scripting language that can respond to user input without going through a Web server. When visiting a web page, JavaScript can directly respond to these events when the mouse is clicked, moved up or down, or moved in the window.
(5) Cross-platform.
The JavaScript script language does not depend on the operating system and only requires browser support. Therefore, after writing a JavaScript script, it can be brought to any machine for use, provided that the browser on the machine supports the JavaScript scripting language. Currently, JavaScript is supported by most browsers. [3]
Unlike server-side scripting languages, such as PHP and ASP, JavaScript is mainly used as a client-side scripting language to run on the user's browser and does not require server support. Therefore, in the early days, programmers preferred JavaScript to reduce the burden on the server, but at the same time it also brought about another problem: security.
As servers become more powerful, although programmers prefer scripts running on the server to ensure security, JavaScript is still popular for its cross-platform and easy-to-use advantages. At the same time, some special functions (such as AJAX) must rely on Javascript to be supported on the client side. With the development of engines such as V8 and frameworks such as Node.js, and their features such as event-driven and asynchronous IO, JavaScript is gradually used to write server-side programs.
Expand your knowledge:
JavaScript scripting language programming examples
JavaScript is a scripting language whose source code does not need to be compiled before being sent to the client for execution. Instead, character codes in text format are sent to the browser for interpretation and execution by the browser. The weakness of literal translation languages is that they are less secure, and in JavaScript, if one cannot run, then the following languages cannot run either. The solution is to use try{}catch(){}:
console.log("a");//This is the correct console.log("b");//This is the correct console.logg("c");//This is wrong, and here it will Stop console.log("d");//This is correct console.log("e");//This is correct/*Solution*/try{console.log("a");} catch(e){}//This is correct `try{console.log("b");}catch(e){}//This is correct try{console.logg("c");}catch (e){}//This is wrong, but it will not stop here, but skip try{console.log("d");}catch(e){}//This is correct try{ console.log("e");}catch(e){}//This is correctJavascript is classified as a literal translation language because mainstream engines load the code and interpret it every time it is run. V8 interprets all the code before starting to run it, while other engines interpret it line by line (SpiderMonkey will temporarily store the interpreted instructions to improve performance, which is called real-time compilation). However, because the core parts of V8 are mostly It is written in Javascript (and SpiderMonkey is written in C++), so in different tests, the performance of the two has advantages and disadvantages. Corresponding to it is a compiled language, such as C language. Before a program written in a compiled language can be run, it must be compiled to compile the code into machine code and then run.