Arrow function (fat arrow functions are new ES6 syntax for writing JS functions to save developers time ease of scope.
//ES5 old school
//ES6
//param1, param2 => expression
//ES5 old school
var multiply = function (x,y){
return x*y;
};
console.log(multiply(2,3));
//ES6
var multiplynew = (x,y) => { return x*y};
console.log(multiplynew(3,4));
No comments:
Post a Comment