January 2020
Intermediate to advanced
548 pages
13h 36m
English
The arrow function is, in many ways, just a slightly more succinct version of the function expression, although it does have some practical differences. It comes in two flavors:
// Regular Arrow Functionconst arrow = (arg1, arg2) => { return 123; };// Concise Arrow Functionconst arrow = (arg1, arg2) => 123;
As you can see, the concise variant includes an implicit return, while the regular variant, much like other function definition styles, requires you to define a regular function body delimited by curly braces in which you must explicitly return a value with a return statement.
Additionally, arrow functions allow you to avoid using parentheses when declaring a function with only one argument. In these cases, you can just ...
Read now
Unlock full access