this in arrow function in javascript code example
Example 1: arrow function javascript
function Welcome(){
console.log("Normal function");
}
const Welcome = () => {
console.log("Normal function");
}
Example 2: javascript arrow function
let add = function(x,y) {
return x + y;
}
console.log(add(10,20));
let add = (x,y) => x + y;
console.log(add(10,20));
let add = (x, y) => { return x + y; };
Example 3: arrow function
function (a){
return a + 100;
}
(a) => {
return a + 100;
}
(a) => a + 100;
a => a + 100;
Example 4: arrow function javascript
function (param) {
var a = param * 3;
return a;
}
(a, b) => {
let c = (a * b) + 3;
return c;
}
Example 5: arrow function javascript
([a, b] = [10, 20]) => a + b;
({ a, b } = { a: 10, b: 20 }) => a + b;