javascript callback arrow function code example
Example 1: arrow function javascript
let myFunction = (arg1, arg2, ...argN) => expression
let myFunction = (arg1, arg2, ...argN) => {
statement(s)
}
let hello = (arg1,arg2) => "Hello " + arg1 + " Welcome To "+ arg2;
console.log(hello("User","Grepper"))
Example 2: concise body arrow functions javascript
const plantNeedsWater = day => day === 'Wednesday' ? true : false;
Example 3: arrow function javascript
([a, b] = [10, 20]) => a + b;
({ a, b } = { a: 10, b: 20 }) => a + b;