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

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

Just use a dead simple loop: function alwaysBlue(things) { const blueThings = {} for (const key in things) // or `for (const key of Object.keys(things))` blueThings[key] = 'blue' return blueThings } Those iteration methods are only good for arrays, which we aren't dealing with here.

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.