ES6 - Arrow functions

0 votes
274 views
added Apr 8, 2020 in ES6 by LC Marshal Captain (25,790 points)
//Arrow function in ES6 simplify the JS function without (function), return and brackets

// ES5
var x = function(x, y) {
   return x * y;
}

// ES6
const x = (x, y) => x * y;

 

1 Response

0 votes
responded Apr 23, 2020 by lcjr First Warrant Officer (11,790 points)
let NewParameters = (a, b) => {
 console.log(a+b); // 30
}
NewParameters(10, 20);

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...