- In arrow function you can omit the curly braces and the
return
statement when the function is a 1 liner.
const myFunc = (a, b) => a + b
console.log(myFunc(1, 2))
// log : 3
- In arrow function when it has only 1 argument, parenthesis is optional
const myFunc = a => a*a
console.log(myFunc(3))
// log : 9
- In arrow function the
this
key word is automatically bound to the parent's context
this
refers to the object that is currently executing the function
Top comments (0)