Monday, 20 March 2017

ES6 Arrow Functions: The New Fat & Concise Syntax in JavaScript

Arrow function (fat arrow functions are new ES6 syntax for writing JS functions to save developers time ease of scope.

//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