JavaScript is the de-facto standard scripting language for the web. It has had ups and downs (loved and hated) in its history, though. With the advent of AJAX and HTML5, JavaScript becomes a must for all web developers.
Short History of JavaScript
Netscape first developed “LiveScript” as a scripting language for Netscape Navigator. The name “JavaScript” is intentional. Netscape joined with Sun Microsystems for the timely release of the “LiveScript,” and the official name of the language became “JavaScript” due to the popularity of Java (Applet) at that time. Java and JavaScript are not related, except they use the C-style syntax.
Later the core part of the language became standardized by ECMA and is named “ECMAScript. “
JavaScript Implementation
JavaScript consists of 3 parts.
- ECMAScript: core syntax and semantics
- DOM (Document Object Model): Document structure and navigation
- BOM (Browser Object Model): Browser specific information
ECMAScript
ECMAScript defines the language itself but not the host environment.
- Types
- Statements
- Operators
- Functions
- Objects
DOM
DOM is an API (Application Programming Interface) for XML. DOM defines the document using hierarchical elements.
- Level 1 (1998) : Core (structure and navigation)
- Level 2 (2000) : Views, Events, Style
- Level 3 (2004) : Load/Save, Validation
BOM
BOM is the least standardized area. In web browsers, the “window” is the main (global) object through which you can access all browser-related information.
- history: the URLs that have been visited before and after the current page
- location: the current URL of the browser window
- navigator: the object about the browser information
- screen: the user’s screen object
JavaScript and ECMAScript
- ECMAScript is the scripting language standardized by ECMA (European Computer Manufacturers Association) International. Well-known dialects are JavaScript, JScript, and ActionScript.
- JavaScript is much more than a client-script language in web browsers. It can be hosted in many environments.
- JavaScript was originally developed for Netscape, and due to its success, MS developed its own dialect JScript. Netscape brought JavaScript to ECMA for standardization in 1996. The name “ECMAScript” was a compromise between Netscape and MS.
- ECMAScript defines the core part of the language. But it is not host-dependent. It does not know anything about HTML or browsers.
Versions of ECMAScript
The first version is released in 1997.
- Version 1: 1997
- Version 2: 1998
- Version 3: 1999
- Version 4: Abandoned
- Version 5: 2009
- Version 5.1: 2011
- Version 6 (ES6): 2015
- Version 7: 2016
- Version 8: 2017
- Version 9: 2018
- Version 10: 2019
- Version 11: 2020
ECMAScript3
The third version had been used widely until ECMAScript5 was released.
ECMA3 introduced the following features:
- Regular expressions
- Exception handling (try/catch)
- Tighter definition of errors
- Formatting for numeric output
ECMAScript5
The version 5 of ECMAScript adds:
- Strict mode
- “JSON” object : JSON.parse() / JSON.stringify()
- “Object” object : reflection methods are added
- Getters and Setters
ECMAScript2015 (ES6)
This version was initially known as ES6 (still widely used) and later renamed “ECMAScript2015”. It introduced significant syntax changes.
- Classes and Modules
- Iterators and for/of loops
- Generators
- Arrow functions
- Collections (maps, sets, and weak maps)
- Promises
- Spread operators
ECMAScript2016
- Exponential Operator (**)
- Array.prototype.includes
ECMAScript2017
- await/async
ECMAScript2018
- spread operator
- rest parameters
- asynchronous iteration
ECMAScript2019
- Array.prototype.flat
- Array.prototype.flatMap
- changes to Array.sort
ECMAScript2020
- BigInt primitive type for arbitrary-sized integers
- nullish coalescing operator
- the globalThis object
Browser Support for ECMAScript
Please refer to the following sites
https://kangax.github.io/compat-table/es6/