I’m overthinking this here. WTF am I doing?
Create a loop to return an object that has the candy name as the key and the cost as the value
function loopingData2() {
let obj = {}
for (let key in store4) {
obj[store4][key] = key
}
return obj
}
var store4 = {
'Dark Chocolate Crunchies': {
'cost': 4.34,
'sold on': ['2015-01-06', '2015-01-06', '2015-01-07', '2015-01-08', '2015-01-08']
},
'Mint Wafers': {
'cost': 1.14,
'sold on': ['2015-01-06', '2015-01-07', '2015-01-07', '2015-01-07', '2015-01-07', '2015-01-07', '2015-01-09', '2015-01-09', '2015-01-09', '2015-01-09']
},
'Peppermint Poppers': {
'cost': 2.43,
'sold on': ['2015-01-07', '2015-01-07', '2015-01-08', '2015-01-08', '2015-01-08', '2015-01-09', '2015-01-10', '2015-01-10']
},
'Peanut Butter Buttered Peanuts': {
'cost': 1.84,
'sold on': ['2015-01-06', '2015-01-06', '2015-01-08']
},
'Berry Bites': {
'cost': 7.94,
'sold on': ['2015-01-06', '2015-01-06', '2015-01-06', '2015-01-07', '2015-01-07', '2015-01-07', '2015-01-07', '2015-01-08', '2015-01-09', '2015-01-09', '2015-01-09', '2015-01-09', '2015-01-10', '2015-01-10', '2015-01-10', '2015-01-10']
},
'Caramel Twists': {
'cost': .55,
'sold on': ['2015-01-07', '2015-01-08', '2015-01-08', '2015-01-08', '2015-01-09', '2015-01-10']
},
'Banana Bunches': {
'cost': 4.58,
'sold on': ['2015-01-06', '2015-01-06', '2015-01-07', '2015-01-10']
}
};