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