Javascript - Arrow Functions
Code Life
By Pierre Marsaa
A Shorter Way to Write Functions
Function expressions are a bit long to type. Modern JavaScript has a compact form: the arrow function. Same idea, no function keyword, and an arrow => between the parameters and the body:
↗️
Loading editor...
↶
↷
Loading editor...
Everything else stays the same: parameters between the parentheses, return in the body, and a normal call with f(2, 3).
Verify