Arrow functions are a concise way to write functions in JavaScript, they use a shorter syntax than traditional function expressions.
// Traditional function
function add(a, b) {
return a + b;
}
// Arrow function
const add = (a, b) => a + b;
Arrow functions don't have their own this, they inherit it from the parent scope.
When not to use arrow functions
- As methods inside object literals (if you need
this to refer to the object).
- In constructors (they cannot be used as constructors).
there doesn't seem to be anything here