Answers for "js for loop of array of strings"

48

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
2

how to iterate array in javascript

array = [ 1, 2, 3, 4, 5, 6 ]; 
   //set variable//set the stop count // increment each loop
for (let i = 0; i < array.length ;i++) { 
  
         array[i] //iterate through each index.
   //add the intructions you would like to perform.
    
             // add any method to array[
}
Posted by: Guest on January-17-2020

Code answers related to "js for loop of array of strings"

Code answers related to "Javascript"

Browse Popular Code Answers by Language