Closed brodycj closed 5 years ago
Yes, that pattern works, but it's harder to debug in the browser console because the function is anonymous.
I thought that modern JS engines would detect this kind of a pattern as a function declaration (Babel JS seems to do this), oh well. Closing for now.
To be honest, I do use the pattern occasionally myself. But I tend to use named functions as much as possible. I know it's fashionable for devs these days to use arrow functions as much as possible. I prefer to use them for what they were designed for: lambdas.
for example (not tested):
more functional, less imperative