- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path20_for_loop.js
More file actions
Latest commit
28 lines (25 loc) · 506 Bytes
/
Copy path20_for_loop.js
File metadata and controls
28 lines (25 loc) · 506 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// for loop
for(leti=0;i<10;i++){
console.log(i);
}
// Step 0: i = 0;
// Step 1: i < 10 true,
// Step 2:executing the block
// Step 3: i++ = 1
// Step 4: i < 10 true,
// Step 5: executing the block
// ...
// ...
// ...
// ...
// Step X - i++ = 9;
// i < 10 true,
// executing the block
// i++ = 10
// 10 < 10 is false
// get out of the loop
console.log('example again');
console.log();
for(letnumber=20;number>=10;number--){
console.log('and number is '+number);
}// 20 ...10