const pizzas = [
{ name: "queen", ing: ["🐷", "🍄", "🍅", "🧀"] },
{ name: "cheese", ing: ["🧀", "🍅", "🌵"] },
{ name: "oriental", ing: ["🍅", "🐑", "🍄", "🌶"] },
];
const prices = new Map([
["🍅", 1],
["🐷", 2],
["🌶", 2],
["🍄", 5],
["🧀", 5],
["🐑", 2],
["🌵", 10],
]);
🪛 Dessinez la structure du code pizzas et pizzasWithPrices (like pythontutor)
const pizzasWithPrices = pizzas.map(pizza => ({
...pizza,
price: pizza.ing.reduce((acc, ing) => acc + prices.get(ing), 0)
}));