Arrow Function
Arrow functions allow a short syntax for writing function expressions. You don't need the function keyword, the return keyword, and the curly brackets.
An arrow function expression is a compact alternative to a traditional function expression, but is limited and can't be used in all situations.
Differences & Limitations:
Does not have
arguments
, ornew.target
keywords.Can not be used as
constructors
.Can not use
yield
, within its body.
Use of this keyword
Unlike regular functions, arrow functions do not have their own this
.
For example:
Availability of arguments
objects
arguments
objectsArguments objects are not available in arrow functions, but are available in regular functions.
Example using regular()
Example using arrow()
Last updated