Answers for "iterate through an array with a for loop explanation"

72

javascript code to loop through array

var colors = ["red","blue","green"];
for (var i = 0; i < colors.length; i++) {
    console.log(colors[i]);
}
Posted by: Guest on July-22-2019
0

Iterating over an Array

const iterable = [10, 20, 30];

for (const value of iterable) {
  console.log(value);
}
// 10
// 20
// 30
Posted by: Guest on October-15-2021

Code answers related to "iterate through an array with a for loop explanation"

Code answers related to "Javascript"

Browse Popular Code Answers by Language