код JavaScript для перехода через массив
var colors = ["red","blue","green"];
for (var i = 0; i < colors.length; i++) {
console.log(colors[i]);
}
Grepper
var colors = ["red","blue","green"];
for (var i = 0; i < colors.length; i++) {
console.log(colors[i]);
}
var arr = ["f", "o", "o", "b", "a", "r"];
for(var i in arr){
console.log(arr[i]);
}
const array = ["one", "two", "three"]
array.forEach(function (item, index) {
console.log(item, index);
});
let numbers = [1,2,3,4,5];
let numbersLength = numbers.length;
for ( let i = 0; i < numbersLength; i++) {
console.log (numbers[i]);
}
const array = ["hello", "world"];
for (item of array) {
//DO THIS
}
var txt = "";
var numbers = [45, 4, 9, 16, 25];
numbers.forEach(myFunction);
function myFunction(value, index, array) {
txt = txt + value + "<br>";
}