loop through array javascript with let code example
Example 1: iterate through array javascript
const array = ["one", "two", "three"]
array.forEach(function (item, index) {
console.log(item, index);
});
Example 2: loop through javascript array
let colors = ['red', 'green', 'blue'];
for (const color of colors){
console.log(color);
}