StackOverflow - javascript, iterator, reduce, airbnb-js-styleguide, eslint-config-airbnb

Reduce with deconstruction or forEach - Iteration and Airbnb JavaScript Style Guide

I'd say the general guideline would be that you can adhere to your coding conventions of choice unless they force you into writing implementations that have a negative impact on performance that is big enough to consider . If that's the case then you will have to make the necessary sacrifice of coding standards in order to write an implementation that performs well enough. I do not know what is your real-world data, but I bet #1 would do just fine and if not then #2 would most likely be a good compromise. The guide doesn't say forEach is bad , it's just not best .

Was this helpful?

Have a different question?

Can't find the answer you're looking for? Submit your own question to our community.

🛎️ Get Weekly OTA Fixes

New answers, vendor issues, and updates — straight to your inbox.