Current location - Trademark Inquiry Complete Network - Trademark inquiry - The difference between ECMAScript and JavaScript
The difference between ECMAScript and JavaScript

There are obvious differences between ECMAScript and JavaScript. ECMAScript is the standard, while JavaScript is the implementation.

JavaScript is a general-purpose scripting language that follows the ECMAScript specification. And it is a forked version of the ECMAScript language. ECMAScript is a scripting programming language standardized by Ecma International (formerly the European Computer Manufacturers Association) through ECMA-262. This language is widely used on the World Wide Web. It is often called JavaScript or JScript, but in fact the latter two are implementations and extensions of the ECMA-262 standard.

The main features of ECMAScript are:

In ECMA-262, ECMAScript compliance is clearly defined. A scripting language must meet the following four basic principles:

1. A conforming implementation must support all "types, values, objects, properties, functions, and programming languages ??and semantics as described in ECMA-262 ";

2. Compliant implementations must support the Unicode Character Standard (UCS);

3. Compliant implementations can add "additional types, Values, Objects, Properties and Functions". ECMA-262 recognizes these additions as new objects or new properties of objects that are not specified in the specification;

4. Compliant implementations can support "program and regular expression syntax" not defined in ECMA-262 ".

The main features of JavaScript are:

It consists of three parts: ECMAScript, BOM and DOM

1. Core - ECMAScript: provides core language functions

p>

2. Document Object Model - DOM: Provides methods and interfaces for accessing and manipulating web content. An application programming interface (API) for XML but extended for HTML. DOM maps the page into a multi-layer node structure. Why use DOM? Netscape and Microsoft each have their own opinions on the development of DHTML. In order to avoid the separation of the two powers and the incompatibility of browsers, and to maintain the cross-platform nature of the Web, DOM came into being.

DOM level 1: It consists of two parts: DOM Core and DOM HTML. DOM Core specifies how to map XML-based document structures. DOM HTML expands on DOM Core and adds objects and methods for HTML.

DOM level 2: Based on the original DOM, mouse and user interface events, scope, and traversal (methods of iterating DOM documents) are expanded, and support for CSS is added through the object interface. DOM level 1 DOM Core has also been extended to support XML namespaces. New modules are introduced: DOM Views - defines an interface for tracking different document views; DOM Events - defines an interface for events and event handling; DOM Style - defines an interface for applying styles to elements based on CSS; DOM Traversal and Range - Defines the interface for traversing and manipulating the document tree.

DOM Level 3: Introduced a method to load and save documents in a unified way - defined in the DOM Load and Save (DOM Load and Save) module; added a new method to validate documents - in DOM Validation (DOM Validation) module defined. DOM Core has been extended to support the XML 1.0 specification, involving XML Infoset, XPath and XML Base.

3. Browser Object Model - BOM: Provides methods and interfaces for interacting with the browser

BOM can access and operate the browser window, and use BOM to control what the browser displays. outside the page. HTML5 is committed to writing many BOM functions into formal specifications.

Fundamentally, the BOM only handles browser windows and frames, but it is customary to count all JavaScript extensions for browsers as part of the BOM, including the functionality to pop up a new browser window, and the functionality to move, zoom, and close browser windows. The navigator object that provides browser details, the location object that provides detailed information about the page loaded by the browser, the screen object that provides detailed information about the user's monitor resolution, support for cookies, and custom objects like XMLHttpRequest and IE's ActiveXObject. BOM is composed of five objects: navigator, history, screen, location, and document.

Supplementary expansion:

JavaScript engine

An interpreter that understands and executes JavaScript code

There will be a JavaScript engine in the browser, such as Chrome has V8, Firefox has SpiderMonkey, and Edge has Chakra. JavaScript engines process JavaScript code similar to how humans process language.

People process languages ??differently, so it is not difficult to understand the differences in how browsers process JavaScript.

Browser performance differences

Assuming that both people can understand the "jump" command, one of them may respond faster because he can understand and process "jump" faster . Likewise, both browsers can understand JavaScript code, but one browser will be faster because its JavaScript engine is implemented in a more efficient way.

Browser support differences

We all know that different people have different understanding and use of the same language. For example, many people use English, and some people know words, phrases, and grammar that others may not. The same goes for browsers. Although the JavaScript engines of browsers all understand JavaScript, some browsers have better understanding capabilities and their support for JavaScript is different.