Skip to content

Commit ddd9933

Browse files
committed
Added loops.js
1 parent 34162f4 commit ddd9933

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

loops.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
let i = 0;
2+
while (i < 3) //While loop runs as long as the condition is evaluated to true
3+
{
4+
console.log(i);
5+
i++;
6+
}
7+
8+
9+
let i = 0;
10+
do { //Do while loop runs as long as the condition is evaluated to true BUT will also run once at the beginning no matter the condition
11+
console.log(i);
12+
i++;
13+
} while (i < 3);
14+
15+
16+
for (let i = 0; i < 3; i++) { //For loop is a loop that automatically increments itself to a fixed number.
17+
alert(i);
18+
}

0 commit comments

Comments
 (0)