The generic term "JavaScript", which is understood in the context of a Web browser, contains several very different elements.
One is the core language (ECMAScript) and the other is a collection of Web APIs, including the DOM (Document Object model)
JavaScript, the core language (ECMAScript)
The core language of JavaScript is standardized by the ECMA TC39 Committee as the ECMAScript language.
This core language is also used in non-browser environments, such as node. js.
ECMAScript defines:
- Language syntax (parsing rules, keywords, control flow, object literal initialization ...) )
- Error handling mechanism (throw, try/catch, ability to create user-defined error types)
- Type (boolean, number, string, function, object, ...) )
- The global object: In the browser, this is a Window object, but ECMAScript only defines browser-specific APIs, such as parseint, parsefloat, decodeURI, encodeURI ...
- The inheritance mechanism based on prototype
- Built-in objects and functions (JSON, Math, Array.prototype method, object introspection method, etc.)
- Strict mode
The ECMAScript internationalization API specification is a supplement to the ECMAScript language specification.
The internationalization API provides a collation (string comparison), number format, and date and time format for JavaScript applications, allowing the application to select languages and customize features as needed.
DOM Apiswebidl
The WEBIDL specification provides the glue between DOM technology and ECMAScript.
The core of the DOM
The Document Object Model (DOM) is a cross-platform, language-independent convention that represents and interacts with objects in html,xhtml and XML documents.
You can address and manipulate objects in the DOM tree by using methods on the object.
The Consortium standardizes the core Document Object model, which defines the language-independent interface that abstracts HTML and XML documents into objects, and defines the mechanism for manipulating this abstraction.
HTML DOM
HTML is the markup language of the web and is specified by the DOM. Layered on top of the abstract concepts defined in DOM Core, HTML also defines the meaning of the element. The HTML DOM includes classname attributes, such as HTML elements, or APIs such as Document.body.
The HTML specification also defines limitations on the document; For example, it requires all the child elements of the UL element that represent unordered lists to be Li elements because they represent list items. Typically, it also prohibits the use of elements and attributes that are not defined in the standard.
Other notable APIs
- The settimeout and SetInterval functions are first specified on the HTML standard Window interface.
- XMLHttpRequest makes it possible to send an asynchronous HTTP request.
- The CSS object Model abstracts CSS rules as objects.
- webworkers allows parallel computations.
- WebSockets allows low-level bidirectional communication.
- Canvas 2D Context is the drawing API for <canvas>.
term "JavaScript"