I have an object called menu
which is of the type IMenu
.
let menu: IMenu[] = [
{restaurant : "KFC", dish:[{name: "burger", price: "1$"}, {name: "french fries", price: "2$"}, {name: "hot dog", data: "1$"}]},
{restaurant : "Chopsticks", dish:[{name: "fried rice", price: "1$"}, {name: "french fries", price: "1$"}, {name: "grilled chicken", data: "2$"}]},
{restaurant : "Crab House", dish:[{name: "fried rice", price: "1$"}, {name: "Crabs", price: "2$"}, {name: "grilled chicken", data: "2$"}]}
]
I am looking to iterate over this object, and if 'fried rice' is found in the dish, perform a specific operation. Is there a way to check for the presence of 'fried rice' within an if statement?
for (let index in menu)
{
let restaurant = await menu[index];
if(<check if restaurant contains 'fried rice'>)
{
//do something
}
}