iterate list in javascript code example
Example 1: iterate array javascript
array = [ 1, 2, 3, 4, 5, 6 ];
for (index = 0; index < array.length; index++) {
console.log(array[index]);
}
Example 2: iterate through list javascript
const array = ["hello", "world"];
for (item of array) {
}
Example 3: js loop array
let colors = ['red', 'green', 'blue'];
for (const color of colors){
console.log(color);
}
Example 4: javascript loop
let array = ["foo", "bar"]
let low = 0;
let high = array.length;
for(let i = low; i < high; i++) {
console.log(i);
console.log(array[i]);
}