ES6 - Spread Operator && Arrow Function
Spread operator
Rest operator in function
function foo(...spreadParam) {}
Rest operator in function with few parameters
function foo(param1, ...spreadParam) {}
For more examples continue reading this article here
Arrow Function
Arrow function is a new way to declare a function in ES6
Simple example
param => returnValue
Simplify call in some functions like map
array.map(value => value * 2)
Object return, wrap the return with parenthesis
param => ({returnObject})
Zero or several params
() => returnValue
(...severalParam) => ({}objectReturn)
Multiple statements in the function
() => {} //use brackets
Code block do not have implicit return at the end
This Binding in array functions
The
This
in the arrow function is the same as the context. It can't be modify with .apply or .call
See all more examples here