The next syntax we will talk about is arrow function.
The traditional way of declaring a function are:
With arrow function:
Other than the fact that
=> is shorter than writing the whole
function keyword, there are a few usages of arrow function that make your code more compact.
No parentheses required for single parameterjs
Implicit return for single expressionjs
Currying (no worries if you not sure what is currying, we will discuss it in more details later)js
Rewrite the following functions with arrow function to make them more compact