Introduction

 

JavaScript (abbreviated as "JS") is a lightweight, interpretive, or real-time compiled programming language with function priority. Although it is well-known as a scripting language for developing web pages, it is also used in many non browser environments. JavaScript is based on prototype programming, a multi paradigm dynamic scripting language, and supports object-oriented, imperative, declarative, and functional programming paradigms.

 

JavaScript was first designed and implemented on Netscape Navigator browser by Brendan Eich of Netscape in 1995. Because Netscape collaborates with Sun, Netscape management wants it to look like Java, so it is named JavaScript. But in fact, its grammar style is closer to Self and Scheme.

The standard for JavaScript is ECMAScript. As of 2012, all browsers fully support ECMAScript 5.1, with older versions supporting at least the ECMAScript 3 standard. On June 17, 2015, ECMA International released the sixth version of ECMAScript, officially known as ECMAScript 2015, but commonly referred to as ECMAScript 6 or ES2015.


 

 

major function

· Embed dynamic text into HTML pages.

· Respond to browser events.

· Read and write HTML elements.

· Validate data before it is submitted to the server.

· Detect visitor's browser information.

· Control cookies, including creation and modification.

· Server side programming based on Node.js technology.


 

 

Operating mode

JavaScript is a high-level scripting language that belongs to the network and has been widely used in web application development. It is commonly used to add various dynamic functions to web pages and provide users with smoother and more beautiful browsing effects. Usually, JavaScript scripts achieve their own functionality by embedding them in HTML.

 

1. It is an interpretive scripting language (code is not pre compiled).

2. Mainly used to add interactive behavior to HTML (an application under the standard universal markup language) pages.

3. You can directly embed HTML pages, but writing them as separate JavaScript files is beneficial for separating structure and behavior.

4. Cross platform feature, supported by the vast majority of browsers, can run on multiple platforms (such as Windows, Linux, Mac, Android, iOS, etc.).

5. JavaScript scripting language, like other languages, has its own basic data types, expressions, arithmetic operators, and basic program framework. JavaScript provides four basic data types and two special data types for processing data and text. Variables provide a place to store information, while expressions can complete more complex information processing.


 

Language characteristics

The JavaScript scripting language has the following characteristics:

 

(1) Script language. JavaScript is an interpretive scripting language, where languages such as C and C++are compiled before execution, while JavaScript is interpreted line by line during program execution.

(2) Object based. JavaScript is an object-oriented scripting language that not only creates objects but also uses existing objects.


 

 

(3) Simple. The JavaScript language uses weakly typed variable types without strict requirements for the data types used. It is a scripting language based on Java basic statements and controls, with a simple and compact design.

(4) Dynamicity. JavaScript is an event driven scripting language that can respond to user input without passing through a web server. When visiting a webpage, JavaScript can directly respond to these events by clicking or moving the mouse up or down, or moving the window within the webpage.

(5) Cross platform. The JavaScript scripting language does not rely on the operating system and only requires browser support. Therefore, a JavaScript script can be used on any machine after writing, provided that the browser on the machine supports the JavaScript scripting language, which is already supported by most browsers. [4] Unlike server-side scripting languages such as PHP and ASP, JavaScript is primarily used as a client-side scripting language to run on users' browsers, without the need for server support. So in the early days, programmers tended to use JavaScript to reduce the burden on the server, while at the same time bringing another issue, security.

With the strength of the server, although programmers prefer scripts running on the server side to ensure security, JavaScript still dominates due to its advantages such as cross platform and ease of use. Meanwhile, some special features (such as AJAX) must rely on JavaScript for support on the client side.


 

COMPILE MODE

JavaScript is a scripting language where the source code does not need to be compiled before being sent to the client for execution. Instead, the character code in text format is sent to the browser for interpretation and execution. The weakness of literal translation languages is poor security, and in JavaScript, if one cannot run, the following languages cannot run either. The solution is to use try {} catch() {}, where an error message is passed in the catch().


 


JavaScript is classified as a literal language because mainstream engines load code and interpret it every time it runs. V8 interprets all the code before starting running, while other engines interpret it line by line (SpiderMonkey temporarily stores the interpreted instructions to improve performance, known as real-time compilation). However, due to the fact that most of the core parts of V8 are written in JavaScript (while SpiderMonkey is written in C++), the performance of the two engines has advantages and disadvantages in different tests. Correspondingly, compiled languages, such as C, require programs written in compiled languages to be compiled into machine code before running.

Comment://It is called a line comment, and the content in/* */will be commented.


 

 

News Center