Arrow Function
Last updated
Was this helpful?
Last updated
Was this helpful?
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 , but is limited and can't be used in all situations.
Differences & Limitations:
Does not have its own bindings to or , and should not be used as .
Does not have , or keywords.
Not suitable for , and methods, which generally rely on establishing a
Can not be used as .
Can not use , within its body.
Unlike regular functions, arrow functions do not have their own this
.
For example:
arguments
objectsArguments objects are not available in arrow functions, but are available in regular functions.
Example using regular()
Example using arrow()