StackOverflow - javascript, arrow-functions, airbnb-js-styleguide

airbnb javascript style arrow-body-style rule, why parentheses out of braces?

According to Airbnb Javascript Style Guide , a pair of parentheses should be added to wrap the braces. But why? // good [1, 2, 3].map((number, index) => ({ [index]: number, })); Is there anything wrong if I code without those parentheses? I mean just return the object is easier to read. // anything wrong with this? [1, 2, 3].map((number, index) => { return {[index]: number}; });

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.