let colors = ['Red', 'Blue', 'Green'];
for (let color of colors){
console.log(color);
}
for (variable of iterable) {
statement
}
for (let itme of list) {
...
}
(function() {
for (const argument of arguments) {
console.log(argument);
}
})(1, 2, 3);
// 1
// 2
// 3
const arr = [1, 2, 3, 4, 5];
// Long-hand
for (let i = 0; i < arr.length; i++) {
const element = arr[i];
// ...
}
// Short-hand
for (const element of arr) {
// ...
}