for (variable of iterable) {
statement
}
Comparison
const colors = ['red', 'green', 'blue'];
// for in loop
for (let x in colors) { //x or color or index or anything else!
console.log(x);
}
const colors = ['red', 'green', 'blue'];
// for of loop
for (let x of colors){
console.log(x);
}



Top comments (0)