Here is an example object that I need help searching:
data = [
{
type: "fruit",
basket: ["apple", "pear", "orange"]
},
{
type: "vegetable",
basket: ["carrot", "potato"]
}
];
I am trying to find the item 'potato' and return its corresponding type, which should be 'vegetable'. I have been attempting to use filter or map in vanilla JavaScript, but I am struggling with the syntax. Can you provide me with a solution?