js for of loop

JavaScript
var colors=["red","blue","green"];
for (let i = 0; i < colors.length; i++) { 
  console.log(colors[i]);
}let panier = ['fraise', 'banane', 'poire'];

for (const fruit of panier) {
  // console.log(fruit);
  console.log(panier.indexOf(fruit));
}const array = ['hello', 'world', 'of', 'Corona'];

for (const item of array) {
  console.log(item);
}JavaScript For Loop: Summary
There are three types of for loops: the regular for loop, the for/in loop and for/of loop.
The for loop iterates through an array.
The for/in loop iterates through the properties of an object.
The for/of loop iterates through iterable objects, like arrays and strings.const array1 = ['a', 'b', 'c'];

for (const element of array1) {
  console.log(element);
}

// expected output: "a"
// expected output: "b"
// expected output: "c"
for (variabile of oggettoIterabile) {
  istruzioni
}

Source

Also in JavaScript: