arrow function javascript w3schhol code example
Example 1: arrow function javascript
params => ({foo: "a"}) // returning the object {foo: "a"}
Example 2: arrow function javascript
// Traditional Function
function (a, b){
return a + b + 100;
}
// Arrow Function
(a, b) => a + b + 100;
// Traditional Function (no arguments)
let a = 4;
let b = 2;
function (){
return a + b + 100;
}
// Arrow Function (no arguments)
let a = 4;
let b = 2;
() => a + b + 100;