Questions about the compact function syntax in ECMAScript2015 (ES6) called "arrow functions" because of their use of "=>".
"Arrow functions" are a compact syntax for function definitions in ECMAScript 2015 (ES6).
Arrow functions differ from regular functions in several ways:
- They cannot be named. They are anonymous only.
- They are not constructors, don't have a
.prototype
and cannot be instantiated bynew
. - They use lexically scoped
this
instead of bindingthis
dynamically on the call
Arrow functions are also available in CoffeeScript.