DEV Community

Discussion on: Regular vs Arrow Function

Collapse
 
peerreynders profile image
peerreynders

MDN: Arrow function expressions:

An arrow function expression is a compact alternative to a traditional function expression, but is limited and can't be used in all situations.

i.e. preferring arrow functions you may be called upon to demonstrate knowledge of when not to use them, e.g. as class methods.

Plain ol' function is still the most appropriate for the general use case (and function hoisting can be quite helpful - you can put functions at the end of the script, out of the way of the primary script). Arrow functions were largely introduced to save you from having to explicitly bind functions for use as event listeners.