Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Arrow functions vs Fat arrow functions

Tags:

People also ask

What is the difference between fat arrow and function?

Arrow function — also called fat arrow function— is a new feature introduced in ES6 that is a more concise syntax for writing function expressions. While both regular JavaScript functions and arrow functions work in a similar manner, there are certain differences between them.

What is a fat arrow function?

Arrow functions allow us to use the fat arrow => operator to quickly define JavaScript functions, with or without parameters. We are able to omit the curly braces and the function and return keywords when creating a new JavaScript function to write shorter function syntax.

How are arrow functions () => {} different than traditional function expressions?

In classic function expressions, the this keyword is bound to different values based on the context in which it is called. With arrow functions however, this is lexically bound. It means that it uses this from the code that contains the arrow function.

Is it better to use arrow functions?

Arrow functions are best for callbacks or methods like map, reduce, or forEach. You can read more about scopes on MDN. On a fundamental level, arrow functions are simply incapable of binding a value of this different from the value of this in their scope.


I've found on the internet about both names, arrow functions and fat arrow functions but no information about what is different between them.

Are there any differences?