Skip to content

Commit 55ee42a

Browse files
authored
Update script.js
1 parent 27bf028 commit 55ee42a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

23-Basic-Loops/script.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
// Print numbers from 1 to 5 using for, while, and do-while loops.
22

3+
// using for loop
34
for (let i = 1; i <= 5; i++) {
45
console.log(i);
56
}
67

8+
// using while loop
79
let j = 1;
810
while (j <= 5) {
911
console.log(j);
1012
j++;
1113
}
1214

15+
// using do-while loop
1316
let k = 1;
1417
do {
1518
console.log(k);

0 commit comments

Comments
 (0)