I need to write a function to transform an object like this:
const foodList = {fruit: {apples: true, pears: false, berries: true}, dairy: {milk: true, cheese: false}, vegetables: {}}
console.log(foodList)
into this:
const result = {fruit: ['apples', 'berries'], dairy: ['milk']}
console.log(result)
I'm trying to convert the nested values to an array where the food key equals true.
depositscome from, should not bedairy? Also, there is noJSONobject, that is just a javascript object. AJSONis a string notation for an object.