ON THIS PAGE 
Loops
JavaScript Loop Statements
for
for ( counter=0; test; counter++)
for (i=0; i <=5; i++) {
    // Logic
}
let counter=2;
for (; i <= 5; counter++)
    // Logic
    break;
}
for in
- iterating over enumerable properties of an object
 
for (let i in object) {
    // Logic for i
}
for (let car in cars) {
    // Logic for car
    console.log(car[cars]]);
}
for of
- initializes array, then interates over vals of array element or iterable object
 
for (const i of array){
    // Logic
}
while
while (test) {
    // Logic
}
do while
do {
    // Logic
} while (test);
Labels
for (let i in object) {
    brightnessLoop: while ( object.brightness >= 100) {
        contrastLoop: while (object.contrast <= 50) {
            optimizeValue(this.object);
            continue everythingLoop;
        }
        i++; // Image value optimized
    }
}
Copyright @ 2025 Anne Brown