Loop html melalui array
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]);
}
const array = ["one", "two", "three"]
array.forEach(function (item, index) {
console.log(item, index);
});
var myStringArray = ["hey","World"];
var arrayLength = myStringArray.length;
for (var i = 0; i < arrayLength; i++) {
console.log(myStringArray[i]);
//Do something
}
var numbers = [1, 2, 3, 4, 5];
numbers.forEach((Element) => console.log(Element));
const array = ["one", "two", "three"]
array.forEach(function (item, index) {
console.log(item, index);
});
Run code snippet
var myStringArray = ["Hello","World"];
var arrayLength = myStringArray.length;
for (var i = 0; i < arrayLength; i++) {
console.log(myStringArray[i]);
//Do something
}
Run code snippet