forked from mtahir08/cmad-javascript
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathquiz_adv_2.txt
102 lines (62 loc) · 1.1 KB
/
quiz_adv_2.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
q1) difference-between-synchronous-and-asynchronous-programming
q2) function func() {
console.log("1");
console.log("2");
console.log("3")
}
func()
q3) function func() {
console.log("1");
setTimeout(()=>{console.log("2");})
console.log("3")
}
q4) function callback() {
console.log("Hello World")
}
function greet(cb) {
cb();
}
greet(callback);
q5)function callback() {
console.log("DONE")
}
function greet(cb) {
var userData = getData(function (data) {
console.log(data.name);
});
setTimeout(()=>{
cb();
},1000 * 10)
}
greet(callback);
q6) function callback() {
console.log("Hello World")
}
function greet(cb) {
cb();
}
greet(callback());
q7)function callback() {
console.log("Hello World");
return function () {
console.log(" ==== DONE ======");
}
console.log("AFTER RETURN");
}
function greet(cb) {
cb();
}
greet(callback());
q8)function callback() {
console.log("Hello World");
return function () {
console.log(" ==== DONE ======");
}
console.log("AFTER RETURN");
}
function greet(cb) {
console.log("1")
cb();
console.log("2")
}
greet(callback());