Pages

Mon forEach

const corbeille = ["Orange", "Banane", "Ananas", "Pamplemousse"];

1) Afficher les fruits de la corbeille de fruits.



2) Coupez les fruits en deux.

 

3) Comment utiliser cette fonction

function randomDrink(fruit, i, fruits) {
  const drinks = ["đŸ„€", "🧋", "đŸč"];
  const choice = drinks[Math.floor(Math.random() * drinks.length)];
  const article = /^[aeiou]/i.test(fruit) ? "d'" : "de ";
  fruits[i] = `${choice} ${article}${fruit}`;
}




Foreach