why arrow function in javascript code example
Example 1: js anonymous function es6
// (param1, param2, paramN) => expression
// ES5
var multiplyES5 = function(x, y) {
return x * y;
};
// ES6
const multiplyES6 = (x, y) => { return x * y };
Example 2: how to make javascript function consise
multiplyfunc = (a, b) => { return a * b; }
Example 3: arrow function javascript
// an arrow function is also called a lambda or an anonymous function
let myFunction = () => {
// some logic
}