Added for loops to display the name properties

This commit is contained in:
2021-10-06 13:58:45 -05:00
parent 2f85e465d5
commit 45f80c726f
+26 -4
View File
@@ -13,15 +13,37 @@ const toys = []
}
return newOBJ
toys.push(newOBJ)
}
const buildingBlocks = createtoyobj(1, "building blocks", "construction toy", `${50.00}`,true,"Quality building blocks for inquiring and creative minds", "Hasboro");
const hotWheels = createtoyobj(2,"hot wheels set", "toy vehicles",`${100.00}`, true, "Beautifully painted model cars! Durable and will keep children entertained for hours. (Not for children under the age of 5, small parts/swallowing hazard", "Mattel");
const stuffedAnimals = createtoyobj(3,"Beanie Babies", "Stuffed Animals", `${15.00}`, false, "Soft, plushy, and cute! Perfect for infants all the way up to 7 years old!", "Beanie Babies");
console.log(buildingBlocks);
toys.push(buildingBlocks, hotWheels, stuffedAnimals)
/* for (const toy of toys) {
console.log(toys)
} */
// I don't think I can access the property as it is buried under a function
/* console.log(buildingBlocks);
console.log(hotWheels);
console.log(stuffedAnimals);
console.log(toys)
console.log(stuffedAnimals); */
console.log(toys);
console.log(buildingBlocks.id);
for(const buildingBlocks of buildingBlocks) {
console.log(buildingBlocks.name)
}
for(const hotWheels of hotWheels) {
console.log(hotWheels.name)
}
for(stuffedAnimals of stuffedAnimals) {
console.log(stuffedAnimals.name)
}