forked from mtahir08/cmad-javascript
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchapters_17-20(CMAD).txt
81 lines (49 loc) · 843 Bytes
/
chapters_17-20(CMAD).txt
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
1) a)
var i = 0;
for( ; i < 10; ){
console.log(i);
i++;
}
1) b)
NOTE: do not run this on your browser,
it will hange your browser
var i = 0;
for( ; ; ){
if(i < 10){
console.log(i);
i++;
}
}
2)for(var i = 0; i < 100; i+=5){
console.log(i);
}
3)for(var i = 0; i < 10; i+=5)
console.log("first line");
console.log("second line");
4) var j = 10;
for(var i = 0; i < 100; i+=j){
console.log("first line"+i);
}
5)var j = 10;
var arr = [4,40,26,69,61,50,65,50,45,10,0];
for(var i = 0; i < arr.length; i++){
console.log("inside for loop"+i);
if(arr[i] == 50 ){
console.log("inside if");
break;
}
}
6) for(var i = 0,k=0; i < 10; i++,k++){
console.log("value of k =="+k);
}
7)for(){
console.log("Hello");
break;
}
8)for(;){
console.log("Hello Pakistan");
}
9)for(;;){
console.log("Hello CMAD");
break;
}