Loops
let n = 0;
while (n < 3) {
console.log(n); // Prints 0, then 1, and then 2
n++;
}let i = 0;
do {
i++;
} while (i > 3); // This is false so the instructions are not repeated
console.log(i); // It still was done 1 time, so it prints 1for (let i = 0; i < 5; i++) { // Start at 0, until 4, incrementing 1 in each cycle
console.log(i); // Prints 0 1 2 3 4
}Last updated