ES6 New Features

Arrows

Arrows are a function shorthand using the => syntax (‘fat arrow’). They are syntactically similar to the related feature in C#, Java 8 and CoffeeScript. They support both expression and statement bodies. Unlike functions, arrows share the same lexical this as their surrounding code.

Scope

The lexical scope (this) in arrow is same as surrounding scope, unlike functions which create new scope.

Symbols

Symbols enable access control for object state. A symbol is a unique and immutable data type and may be used as an identifier for object properties.
Symbols are a new primitive type. Optional name parameter used in debugging – but is not part of identity. Symbols are unique, but not private since they are exposed via reflection features like Object.getOwnPropertySymbols.

Generators

Generators are functions that can be paused(exit) and resumed(re-enter).
Their context (variable bindings) will be saved across re-entrances.
These can be helpful for iterators, asynchronous programming, etc.

Execution

Calling a generator function does not execute its body immediately; an iterator object for the function is returned instead.
When the iterator’s next() method is called, the generator function’s body is executed until the first yield expression.

The for…of statement creates a loop Iterating over iterable objects (including Array, Map, Set, arguments object and so on),
invoking a custom iteration hook with statements to be executed for the value of each distinct property.

Promises

Promises are a library for asynchronous programming. Promises are a first class representation of a value that may be made available in the future.
Promises are used in many existing JavaScript libraries.

ES6 Promise API

The de-facto standard for JavaScript promises is called Promises/A+. ES6 Promise API follows this standard.

Promises are a pattern that helps with asynchronous programming, functions that return their results asynchronously.

Global functions

Four number-related functions are already available as global functions and have been added to Number, as methods: isFinite, isNaN, parseFloat and parseInt.

The Object.assign() method only copies enumerable and own properties from a source object to a target object.
It uses [[Get]] on the source and [[Put]] on the target, so it will invoke getters and setters.
Therefore it assigns properties versus just copying or defining new properties.

Exceptions on Object

Note that Object.assign() does not throw on null or undefined source values.

Default + Rest + Spread

ES6 gives us a way to set default function parameters. Any parameters with a default value are considered to be optional.