Functions in ES6
In ES6, we can put the default values right in the signature of the functions. Default value expressions are evaluated at function call time from left to right.
The new syntax is quite handy when you just need a simple function with one argument. You can skip typing function and return, as well as some parentheses and braces.
const hello = x => "Hi! " +x;
The code above defines a function named hello that has one argument and returns a message.
Similarly, we can add multiple parameters.
const add = (x,y) => x+y;
We can define the default value of the parameter like this:-
const div = (x,y=2) => x/y;