I wanted the food with the lowest price to be displayed on the console, but my code does not work. Thank you for helping me get the correct code.
Give me the output I want : name : Berger price : 23.83
let menu = [
{ id: 1, name: "Soda", price: 3.12, size: "4oz", type: "Drink" },
{ id: 2, name: "Beer", price: 6.50, size: "8oz", type: "Drink" },
{ id: 3, name: "Margarita", price: 12.99, size: "12oz", type: "Drink" },
{ id: 4, name: "Pizza", price: 25.10, size: "60oz", type: "Food" },
{ id: 5, name: "Kebab", price: 31.48, size: "42oz", type: "Food" },
{ id: 6, name: "Berger", price: 23.83, size: "99oz", type: "Food" },
];
const cheap_food = () => {
const cheap = menu.filter(menuItem => menuItem.price > 0 && menuItem.type === "Food");
cheap.forEach(price => console.log(Math.min(price)));
}
cheap_food();