Abhay Jain

Jan 5, 2021

2 min read

When (to and not to) use ES6 Arrow functions in JavaScript?

It is important to note that arrow functions are anonymous, which means that they are not named.

This anonymity creates some issues:

Harder to debug

No self-referencing

Main benefit: No binding of ‘this’

When you should not use Arrow Functions

Object methods

var cat = {
lives: 9,
jumps: () => {

Callback functions with dynamic context

var button = document.getElementById('press');
button.addEventListener('click', () => {

When it makes your code less readable

When you should use them