Answers for "cycle through an array in javasfript"

18

loop array javascript

var colors = ['red', 'green', 'blue'];
	
	colors.forEach((color, colorIndex) => {
     console.log(colorIndex + ". " + color); 
    });
Posted by: Guest on April-08-2020
13

iterate through array js

var arr = ["f", "o", "o", "b", "a", "r"]; 
for(var i in arr){
	console.log(arr[i]);
}
Posted by: Guest on November-12-2021

Code answers related to "cycle through an array in javasfript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language