arrow functions

arrow functions are shorter syntax instead of using conventional way to write function.

eg -

const sum = (a,b) => { return a+b; }

console.log(sum(5,6));

To make it even more shorter ->

const sum = (a,b) => a+b;

console.log(sum(5,7));

So if the arrow function is returning only one value then no need to write return or curly braces.

  • arrow function doesn't have it's own this.

    it always refers to the global or window reference.