ES6 (ECMAScript 2015)

Arrow Function =>

1
var helloMessage = (message, name) => message + name

With one parameter

1
var helloMessage = name => 'Hello ' + name;

Rq : this is available in the arrow function - this is no longer referring to the scope inside of the function. It’s referring to the scope that’s outside of the function.

Let Keyword

  • var is not scoped. So can be reassigned in a block
  • but ES5 does have function scoping, so var can not be reassigned in a function, but in a loop (or a block), it can be reassigned
  • now, let in ES6 allow to use block scoping.

Default Values for Function Parameters

1
2
3
4
5
function greet(greeting, name = "John"){
console.log(greeting + ", " + name);
}

greet("Hello");

allow you to assign some defaults values or function

const declaration

a const declaration allows to declare a variable that is read only. (is not actually a constant variable, but a constant reference.)
can assign and reassign properties of a const object without breaking my const rules, but can not reassign object const because I have changed the reference of this const declaration.

Also const declarations adhere to block scope. Block scope can simply be understood as anything between two curly brackets. (same behahvior as let)

Shortalnd Properties

Object Enhancements

Spread Operator

Template literals

Destructuring Assignements

ES6 Modules

Array.from

Promises

Generators

Map and WeakMaps

Parameter Object Destructuring with Required Values

ES6 Rest Parameters