r/javascript • • Nov 28 '19

Constant confusion: why I still use JavaScript function statements

https://www.freecodecamp.org/news/constant-confusion-why-i-still-use-javascript-function-statements-984ece0b72fd/
2 Upvotes

9 comments sorted by

View all comments

1

u/gigastack Nov 28 '19

Agreed on some points, but for callbacks and inline functions like map/forEach, it's arrow functions all the way. Ditto for class methods in a React component. Basically, I mostly use arrow functions but it depends on the type of code you're writing.

2

u/MrDilbert Nov 28 '19

I think it was mentioned at the end of the article that arrow functions are still the better (i.e. more readable/understandable) option for callbacks and array functions.