pętla JavaScript przez tablicę
var colors = ["red","blue","green"];
colors.forEach(function(color) {
console.log(color);
});
Gifted Gerenuk
var colors = ["red","blue","green"];
colors.forEach(function(color) {
console.log(color);
});
for (i in things) {
// If things is an array, i will usually contain the array keys *not advised*
// If things is an object, i will contain the member names
// Either way, access values using: things[i]
}
for(var i = 1; i <= 10;i++){
console.log(i)
}
const numbers = [3, 4, 8, 9, 2];
for (let i = 0; i < numbers.length; i++) {
const accessNumbers = numbers[i];
console.log(accessNumbers);
}
//Expected output:3 4 8 9 2
while (myCondition) {
// The loop will continue until myCondition is false
}
let i = 0;
do {
i += 1;
console.log(i);
} while (i < 5);