I was actually about to downvote this question, but googling the answer proved surprisingly difficult if you don't already know what its called. As you can see in the links in the comments, that's a fat arrow function (sometimes referred to as just an arrow function).
There are some confusing aspects of arrow functions, so I'll hit some highlights:
Normal functions have a this
pointer set depending on the context: functions called with new
have it set to the newly-created object, functions called as methods have it bound to the object the method was called from, its otherwise bound to undefined
or the global object (depending on the 'strict mode' pragma), and can of course be set with Function.prototype.bind
et al.
But arrow functions have no binding for the this
pointer created by the runtime (nor can it be specified via Function.prototype.bind
), meaning it gets lexically looked up through scope chain resolution just like any other var. The MDN article is at best slightly confusing on this point (see link above).
Additionally, arrow functions have an implicit return, the return value will automatically be the last evaluated expression in the function body.
Arrow functions have no arguments
psuedo-array. You can use ES 6 rest parameters instead.
For functions of arity 1, the parens around the parameter may be omitted.