array on loop code example
Example 1: loop array javascript
var colors = ['red', 'green', 'blue'];
colors.forEach((color, colorIndex) => {
console.log(colorIndex + ". " + color);
});
Example 2: how to use for loops to work with array in javascript
for(let i = 0; i < myArray.length; i++){