pętla HTML przez tablicę
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 imgs = document.querySelectorAll(".img");
// You can't simply use imgs.forEach as it is not exactly an array. To fix that, first convert it to an array and then iterate.
[...imgs].forEach(img => {
console.log(img);
});