StackOverflow - StackOverflow

unexpected use of comma using map on a object

I'm using the AirBnb style guide and get an "unexpected use of comma" error here at the end of the first line of code:

  myApp.fields.map(field => (field.obj.label = field.label.default,
    field.label.textContent = field.obj.label));

I can rewrite it to this to remove the error:

  myApp.fields.map(field => field.obj.label = field.label.default);
  myApp.fields.map(field => field.label.textContent = field.obj.label);

https://eslint.org/docs/rules/no-sequences

The way I see the first bit of code that the map loop only runs once of the fields where the second one runs twice.

I can confirm that both parts of the map above are executing and not just the last one. Is there something else I'm missing?

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.