Gistlib Logo

gistlib

create to loop in javascript

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

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

// Do-while loop
let k = 0;
do {
    console.log(k);
    k++;
} while (k < 5);
217 chars
19 lines

similar javascript code snippets

print the numbers from 1 to 100 in javascript
loop array in javascript
build a list of the numbers from 1 to 100 in javascript
print the numbers from 1 to 100, but only print the even numbers in javascript
reset a loop in javascript
print the numbers from 1 to 100, but only print the even numbers. use a while loop in javascript
find pivot point in javascript
how to get the cartesian product of two sets in javascript
search array until value is found in javascript
how to create an array of size n with numbers filled from 1 to n in javascript

related categories

javascript
loops

gistlibby LogSnag