Essentially, I am trying to create a for loop which creates an object containing each candy's name and price. I can access the inventory for a certain day with no problems using this
console.log(store3[4]['inventory sold'])
{ 'Dark Chocolate Crunchies': { cost: 4.29, quantity: 2 },
'Mint Wafers': { cost: 1.09, quantity: 1 },
'Peppermint Poppers': { cost: 2.38, quantity: 0 },
'Peanut Butter Buttered Peanuts': { cost: 1.79, quantity: 2 },
'Berry Bites': { cost: 7.89, quantity: 5 },
'Caramel Twists': { cost: 0.5, quantity: 7 },
'Banana Bunches': { cost: 4.53, quantity: 2 } }
As well as this
console.log(store3[4]['inventory sold']['Mint Wafers'])
{ cost: 1.09, quantity: 1 }
However, for a for loop, I need to use numerical values, and for some reason I get undefined when I try to run the prior command in this format. Any suggestions?
console.log(store3[4]['inventory sold'][1])
undefined