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

31 Views Asked by At

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};
});
0

There are 0 best solutions below