why to use arrow functions over normal function

Solutions on MaxInterview for why to use arrow functions over normal function by the best coders in the world

showing results for - "why to use arrow functions over normal function"
Knox
11 Jan 2020
1// => why to choose arrow function over normal function 
21. short syntax, good as callback functions
3 ([].map(() => {}) is better than [].map(function () {}))
4
52. when using class component, with arrow functions no need to bind this
6
7// example: 
8
9 -// this will be undefined
10		button.addEventListener('click', () => {console.log(this); })
11  // this will refer to dom button
12		button.addEventListener('click', function () {console.log(this); })