The future is coming
ECMAScript 6, also known as ECMAScript 2015, is the upcoming version of the ECMAScript standard. This standard is targeting ratification in June 2015. ES6 is a significant update to the language, and the first update to the language since ES5 was standardized in 2009.
ES6
ES5
ES6
ES6
ES6
ES6
Map
Set
WeakMap
WeakSet
ES5
ES6
ES5
ES6
ES6
ES6
Syntax
Syntax
ES5
ES6
ES5
ES6
ES5
ES6
ES6
ES6
ES5
ES6
ES5
ES6
ES6
ES6
ECMAScript 6 provides a global symbol registry that you can access at any point in time.
In addition to the symbols you defined, there are some predefined symbols as well (called well-known symbols in the specification). These symbols represent common behaviors in JavaScript that were previously considered internal-only operations.
ES5
ES6
ES6
ES6
ES5
ES6
ES6
A generator is a special kind of function that returns an iterator.
ES6
The most interesting aspect of generator functions is that they stop execution after each yield statement
ES6
Closely related to the concept of an iterator is an iterable. The for-of loop is similar to the other loops in ECMAScript except that it is designed to work with iterables.
ES6
Developer-defined objects are not iterable by default, but you can make them iterable by using the @@iterator symbol. For example:
ES6
Another way that ECMAScript 6 makes using iterators easier is by making iterators available on many objects by default.
ES6
Result
In reality, though, template strings are ECMAScript 6’s answer to several ongoing problems in JavaScript:
ES6
ES6
Proxies enable creation of objects with the full range of behaviors available to host objects. Can be used for interception, object virtualization, logging/profiling, etc.
ES6
The Promise object is used for deferred and asynchronous computations. A Promise is in one of these states:
ES6
Function object with two arguments
ES6
ES6
ES6