As we all know, JavaScript is a literal scripting language, a dynamically typed, weakly typed, prototype-based language with built-in support for types. And because its name includes java in front of it, many people think that it is written in java language, but in fact it is not.
# Having said that, I have to bring up the historical origin of the name javascript. . .
In 1995, Netscape recruited Brandon Ek with the goal of embedding the Scheme language into the Netscape Navigator browser.
But earlier, Netscape had cooperated with Sun to support Java in Netscape Navigator. At this time, there was a fierce debate within Netscape.
Later Netscape decided to invent an auxiliary scripting language that could be used with Java and had a similar syntax. This decision ruled out the use of existing languages such as Perl, Python, Tcl or Scheme.
To defend the idea of JavaScript among other competing proposals, the company needed a working prototype. Ike designed the prototype in just ten days in May 1995. Its syntax style is closer to Self and Scheme.
Originally named Mocha, it was renamed LiveScript in the Beta version of Netscape Navigator 2.0 in September 1995. In December of the same year, it was renamed JavaScript when deployed in Netscape Navigator 2.0 Beta 3. At that time, the development alliance formed by Netscape and Sun Microsystems temporarily changed its name to JavaScript in order to make the language catch up with the "hot word" of Java, a programming language. In the future, this became the reason why the public had many misunderstandings about this language. one of the reasons.
So java language is not its underlying language.
Generally speaking, complete JavaScript includes the following three parts:
ECMAScript, which describes the syntax and basic objects of the language.
Document Object Model (DOM) describes the methods and interfaces for processing web content.
Browser Object Model (BOM) describes the methods and interfaces for interacting with the browser.
JavaScript is commonly used to accomplish the following tasks:
Embed dynamic text in HTML pages Respond to browser events Read and write HTML elements Validate data before it is submitted to the server Detect visitors' browser information to control cookies, including creation and modification.
JavaScript script language has the following characteristics:
(1) Script 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 the 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.
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.
The above is the detailed content of What language is the underlying language of js?. For more information, please follow other related articles on the PHP Chinese website!