Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript array

//create an array:
let colors = ["red","blue","green"];

//you can loop through an array like this:
//For each color of the Array Colors
for (color of colors){
  console.log(color);
}

//or you can loop through an array using the index:
for (var i = 0; i < colors.length; i++) {
    console.log(colors[i]);
}
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #javascript #array
ADD COMMENT
Topic
Name
7+4 =