run it and see how it works
var obj = {
bakery1: {
small: {
name: "Small cookie",
price: 0.75
},
large: {
name: "Large cookie",
price: 3.00
}
},
bakery2: {
small: {
name: "Small cookie",
price: 1.00
},
large: {
name: "Large cookie",
price: 4.00
}
}
};
Object.keys(obj).map((name) => {
Object.keys(obj[name]).map((type) => document.write(`${name}-${type}-${obj[name][type].name}-${obj[name][type].price}
`))
})