What is ES6 (ECMAScript 2015)?

The 6th edition, ECMAScript 6 (ES6) and later renamed to ECMAScript 2015, was the second major revision to JavaScript and finalised in June 2015 (the first was ES5, which was also known as ECMAScript 2009). This update adds significant new syntax for writing complex applications, including class declarations (class Foo { ... }), ES6 modules like import * as moduleName from "...";, export const Foo, but defines them semantically in the same terms as ECMAScript 5 strict mode.
Other new features include iterators and for...of loops, Python-style generators, arrow function expression (() => {...}), let keyword for local declarations, const keyword for constant local declarations, binary data, typed arrays, new collections (maps, sets and WeakMap), promises, number and math enhancements, reflection, proxies (metaprogramming for virtual objects and wrappers) and template literals for strings. The complete list is extensive. As the first "ECMAScript Harmony" specification, it is also known as "ES6 Harmony."
Sources: Wikipediaopen in new window, W3Schoolsopen in new window

Copyright © Dusty 2021 - 2021