Answers for "javascrip for loop array"

48

js loop 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
8

loop array javascript

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

javascript loop an array

for(let i =0; i < arr.length; i++) {
	console.log(arr[i])
}
Posted by: Guest on April-30-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language