11

It's truly incredible, what people can create:

let categoriesText = '';
categories.forEach((item, i) => {
if (i !== 0) {
categoriesText =
categoriesText + `, ${item.categoryName}`;
} else {
categoriesText =
categoriesText + `${item.categoryName}`;
}
});
return categoriesText

How about you STFU!!!

return categories.map((category) => category.categoryName).join(', ');

Comments
Add Comment