Have to start getting used to some iterator syntax. Here’s how we USED to do it:
for (let color in colors) {
let colorObj = {};
colorObj.code = colors[color].colorPrdId;
colorObj.name = colors[color].colorName;
colorObj.imgSwatch = colors[color].imgSwatch;
collection.push(colorObj);
}
Here’s the new way to code the same thing:
colors.forEach(function (color) {
collection.push({
code: color.colorPrdId,
name: color.colorName,
imgSwatch: color.imgSwatch
});
});