javascript loop throught array code example
Example 1: loop through javascript array
let colors = ['red', 'green', 'blue'];
for (const color of colors){
console.log(color);
}
Example 2: how to loop through array of numbers in javascript
let numbers = [1,2,3,4,5];
let numbersLength = numbers.length;
for ( let i = 0; i < numbersLength; i++) {
console.log (numbers[i]);
}