StackOverflow - StackOverflow

unexpected use of comma using map on a object

Since you're not transforming the array, you could just use forEach() instead of map(). If you insist on making it into a one-liner, and don't want to violate the no-sequences rule:

myApp.fields.forEach(field => {field.obj.label = field.label.default; field.label.textContent = field.obj.label});

More readable:

myApp.fields.forEach((field) => {
    field.obj.label = field.label.default;
    field.label.textContent = field.obj.label;
});

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.