javascript loop thrugh array
var colors = ["red","blue","green"];
for (var i = 0; i < colors.length; i++) {
console.log(colors[i]);
}
javascript loop thrugh array
var colors = ["red","blue","green"];
for (var i = 0; i < colors.length; i++) {
console.log(colors[i]);
}
how to loop through an array
var array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//loop thrugh all of the numbers of the array and print them
for(let i = 0; i < array.length; i++){
console.log(array[i]); //print all the array data in the length of i
}
//we can create some variable that store the array data and than display it
//using for...of
for(let data of array){
console.log(data); //print all the data that was stored in the "data" variable
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us