Arrow functions in Javascript ES6
Continuing from the last tutorial, we changed the anonymous function in an arrow function like this…
This is equivalent to use of anonymous function…
but is much more concise.
You drop the function keyword and add the arrow operator. The input parameters are on the left and function body on the right. If there are more than one input param, you enclose in parenthesis and separate them by commas. If there are more than one line in the function body, you need to bound the body in curly braces and are formatted as such …
Another thing to note about arrow functions is that the “this” binding has changed from previous. More about this referenced here.