код 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]);
}
var colors = ["red","blue","green"];
colors.forEach(function(color) {
console.log(color);
});
var txt = "";
var numbers = [45, 4, 9, 16, 25];
numbers.forEach(function(value, index, array) {
txt = txt + value + "<br>";
});
const array = ["one", "two", "three"]
array.forEach(function (item, index) {
console.log(item, index);
});
foreach ($objects as $obj) {
echo $obj->property;
}