boucle for i js code example
Example 1: boucle for in js
let panier = ['fraise', 'banane', 'poire'];
for (const fruit in panier) {
console.log(panier[fruit]);
}
Example 2: boucle for of javascript
let panier = ['fraise', 'banane', 'poire'];
for (const fruit of panier) {
// console.log(fruit);
console.log(panier.indexOf(fruit));
}