Skip to main content

Loop

for loop

for (let i = 0; i<10; i++) {
console.log(i);
}

while loop

let i = 0;
while (i<10) {
console.log(i);
i++;
}

do-while loop

let i = 0;
do {
console.log(i);
i++;
} while (i <10);