how to create looping in javascript

index.tsx
// There are multiple types of loops in JavaScript, such as for loop, while loop, and do...while loop.

// 1. For Loop
for (let i = 0; i < 5; i++) {
    console.log(i);
}

// 2. While Loop
let j = 0;
while (j < 5) {
    console.log(j);
    j++;
}

// 3. Do...While Loop
let k = 0;
do {
    console.log(k);
    k++;
} while (k < 5);
332 chars
21 lines

related categories

gistlibby LogSnag