JavaScript Loop Statements
2025-01-08
for ( counter=0; test; counter++)
for (i=0; i <=5; i++) {
// Logic
}
let counter=2;
for (; i <= 5; counter++)
// Logic
break;
}
for (let i in object) {
// Logic for i
}
for (let car in cars) {
// Logic for car
console.log(car[cars]]);
}
for (const i of array){
// Logic
}
while (test) {
// Logic
}
do {
// Logic
} while (test);
for (let i in object) {
brightnessLoop: while ( object.brightness >= 100) {
contrastLoop: while (object.contrast <= 50) {
optimizeValue(this.object);
continue everythingLoop;
}
i++; // Image value optimized
}
}
Â