Home>Article>Web Front-end> Let’s take a look at the differences between ECMAScript and JavaScript
Free learning recommendation:js video tutorial
##1. Introduction to ECMAScript
ECMAScript is a script programming language standardized by Ecma International (formerly the European Computer Manufacturers Association, the English name is European Computer Manufacturers Association) through ECMA-262 . This language is widely used on the World Wide Web. It is often called JavaScript or JScript, so it can be understood as a standard for JavaScript, but in fact the latter two are implementations and extensions of the ECMA-262 standard.1.1 ECMA International
ECMA International is an information and telecommunications standards organization with an international membership system. It is an organization closely connected with enterprises, so the specifications formulated by Ecma International Standards are mainly formulated and promoted by various enterprises. In 1997, the organization released the MCMA-262 standard, which formulated the ECMAScript language specification. This is where ECMAScript comes from.1.2 ECMA-262 standard (ES standard)
ECMA-262 is a specification standard for scripting languages developed by the ECMA TC39 group. TC39 members are composed of programmers from companies interested in script programming. The ECMA-262 standard defines the ECMAScript language specification. This standard is also called the ECMAScript Language Specification, or ES specification for short. The ES specification was released in 1997 and is now the eighth version. ECMAScript is based on several primitive technologies, most notably JavaScript (Netscape Navigator 2.0) and JScript (Microsoft IE3).1.3 The process of JavaScript standardization
Around 1995: The Internet broke out and Web applications emerged in endlessly. At that time, as long as you registered a .com domain name, you could basically become rich. , just like current blockchain and artificial intelligence. At that time, there were three mainstream versions of JavaScript: (1) JavaScript in Netscape Navigator 3.0. (2)JScript in IE. (3) ScriptEase in CEnvi. Unlike other programming languages, JavaScript does not have a standard to unify its syntax or features, and these three different versions just highlight this problem. As concerns in the industry increase, it is clear that standardization of this language is imperative. 1997: JavaScript 1.1 is submitted as a draft to the European Computer Manufacturers Association (ECMA). Technical Committee 39 (TC39) was appointed to "standardize the syntax and semantics of a general-purpose, cross-platform, vendor-neutral scripting language." The first version of ECMA-262 was hammered out, which defined a new scripting language called ECMAScript. 1998: The International Organization for Standardization and the International Electrotechnical Commission (ISO/IEC) also adopted ECMAScript as a standard (ISO/IEC-16262). The second version of ECMA-262 (ES2) was released in the same year. The second version basically did not add new features. 2002: ECMA-262 third edition (ES3), newly introduced powerful regular expressions, better string processing, new control statements, try/catch exception handling, stricter Error definitions, formatting of numerical output, and minor changes in anticipation of future language growth. The third version was very widely used at the time, and almost all browsers supported the ES3 standard. ECMA-262 version 4 (ES4) died prematurely, and some functions were migrated to ES6. 2009: ECMA-262 fifth edition (ES5) is released. Many features have been added based on ES3: including accessor properties, reflective creation and inspection of objects, programmatic control of properties, additional array manipulation functions, support for the JSON object encoding format, and enhanced error checking and program security. strict mode. 2011: Approved as the international standard ISO/IEC 16262:2011. The ES5.1 version was released in the same year (with some upgrades and optimizations to ES5) and was approved by MCMA-262 and ISO/IEC.2015: ECMA-262 Sixth Edition (ES6 or ES 2015 Language Specification), ES6 can be said to have begun to precipitate after the release of ES3 in 2000. Due to the death of ES4, Some features in ES4 were not released until ES6, so the sixth version is completely the result of fifteen years of hard work.
ES6Provide better support for large applications, create Lib libraries, and use ECMAScript as a compilation target for other languages. ES6 mainly adds the following features: Major enhancements include modules, class declarations, lexical block scope, iterators and generators, promises for asynchronous programming, destructuring patterns and proper tail calls. The built-in ECMAScript library has been extended to support additional data abstractions, including maps, sets, and binary numeric arrays, as well as the use of strings and regular expressions.
2. Introduction to JavaScript
JavaScript is a literal scripting language. It is a dynamically typed, weakly typed, prototype-based language with built-in support for types. Its interpreter is called the JavaScript engine, which is part of the browser and is widely used in client-side scripting languages. It was first used on HTML (an application under Standard Universal Markup Language) web pages to add dynamic functions to HTML web pages. .JavaScript is a universal cross-platform scripting language that complies with the ECMA-262 standard (ES standard), in other words, it is a dialect of ECMAScript. In order to gain technical advantages, Microsoft launched JScript, and CEnvi launched ScriptEase, which can also run on the browser like JavaScript. In order to unify specifications, JavaScript is also called ECMAScript because it is compatible with the ECMA standard.
The JavasSript trademark belongs to Oracle because Sun was acquired by Oracle. JavaScript was registered by Sun in the early years and represents the JavaScript language. But the first invention of JavaScript was Netscape. In 1995, it was first designed and implemented on the Netscape Navigator browser by Brendan Eich of Netscape. Because Netscape was working with Sun, Netscape management wanted it to look like Java, hence the name JavaScript. But in fact its grammatical style is closer to Self and Scheme.
2.1 Basic characteristics of JavaScript
JavaScript is a scripting language that belongs to the Internet. It has been widely used in Web application development and is often used to add various functions to web pages. The dynamic function provides users with a smoother and more beautiful browsing effect. Usually JavaScript scripts realize their functions by embedding them in HTML.
(1) An interpreted scripting language (the code is not precompiled).
(2) Mainly used to add interactive behaviors to HTML (an application under the Standard Universal Markup Language) page.
(3) It can be directly embedded in HTML pages, but writing it as a separate JS file is beneficial to the separation of structure and behavior.
(4) Cross-platform feature, with the support of most browsers, it can run on multiple platforms (such as Windows, Linux, Mac, Android, iOS, etc.).
Javascript scripting language, like other languages, has its own basic data types, expressions and arithmetic operators, and the basic program framework of the program. Javascript provides four basic data types and two special data types for processing data and text. Variables provide a place to store information, and expressions can complete more complex information processing.
2.2 JavaScript components
JavaScript consists of three parts: ECMAScript, DOM, and BOM, as shown below.
(1) ECMAScript: Describes the syntax and basic objects of the language.
(2) DOM: Document Object Model (DOM), describing methods and interfaces for processing web content.
(3) BOM: Browser Object Model (BOM), describing the methods and interfaces for interacting with the browser.
2.2.1 DOM Document Object Model
The Document Object Model (DOM for short) is a standard programming for processing extensible markup languages recommended by the W3C organization interface. On a web page, the objects that organize the page (or document) are organized in a tree structure. The standard model used to represent the objects in the document is called DOM. The history of the Document Object Model can be traced back to the "browser war" between Microsoft and Netscape in the late 1990s. In order to compete for life and death in JavaScript and JScript, both parties gave browsers powerful functions on a large scale. Microsoft has added many proprietary things to web technology, including VBScript, ActiveX, and Microsoft's own DHTML format, which makes many web pages unable to display properly using non-Microsoft platforms and browsers. DOM is the masterpiece brewed at that time.
2.2.2 BOM Browser Object Model
BOM (Browser Object Model) is the browser object model. BOM provides objects that interact with browser windows independently of content; since BOM is mainly used to manage communication between windows, its core object is window; BOM consists of a series of related objects, and each object Both provide many methods and attributes; BOM lacks standards. The standardization organization for JavaScript syntax is ECMA, and the standardization organization for DOM is W3C. BOM was originally part of the Netscape browser standard.
Some objects that the browser window interacts with, such as the window object that can move and resize the browser, the location object and history object that can be used for navigation, and the navigator that can obtain browser, operating system, and user screen information. With the screen object, you can use the document as the entrance to access the HTML document, manage the frames object of the frame, etc.
2.3 JavaScript processing engine
The JavaScript processing engine is an interpreter that can parse and run JavaScript code. Browsers usually have JavaScript engines. When JavaScript first came out, it ran in the browser and was used as a client-side language.
Common JavaScript engines:
(1) Chrome V8
(2) Firefox SpiderMonkey
(3) Microsoft Edge Chakra
Mention that Node.js is based on the Chrome V8 engine. As mentioned above, the V8 engine is used to parse and execute JS, and V8 is implemented based on the ECMAScript standard. To put it another way, there are no DOM and BOM operations in Node.js. It only retains the syntax core (ES) of JavaScript and adds an event-driven non-blocking I/O model to make it lightweight and efficient. Node.js runs as a service on Windows, Linux, and Mac, shifting the role of JavaScript from front-end development to back-end development.
The currently somewhat outdated ActionScript for Flash programming is also a specific implementation of ECMAScript.
Related free learning recommendations:javascript learning tutorial
The above is the detailed content of Let’s take a look at the differences between ECMAScript and JavaScript. For more information, please follow other related articles on the PHP Chinese website!