creata a lop in javascript

index.tsx
// To create a loop in JavaScript, you can use different types of loops such as for loop, while loop, and do-while loop.

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

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

// 3. Do-while loop example
let k = 0;
do {
    console.log(k);
    k++;
} while (k < 5);
372 chars
21 lines

related categories

gistlibby LogSnag