File tree Expand file tree Collapse file tree 1 file changed +173
-0
lines changed Expand file tree Collapse file tree 1 file changed +173
-0
lines changed Original file line number Diff line number Diff line change
1
+ <div align =" center " >
2
+ <h1 >Functions</h1 >
3
+ </div >
4
+
5
+ <ol >
6
+
7
+ <li >
8
+
9
+ ** What will be the output ?**
10
+
11
+ ``` js
12
+ x = 1 ;
13
+ function func () {
14
+ this .x = 2 ;
15
+ return x;
16
+ }
17
+ let a = new func ();
18
+ console .log (a .x );
19
+ ```
20
+
21
+ - A: ` 1 `
22
+ - B: ` 2 `
23
+ - C: ` undefined `
24
+
25
+ <br />
26
+
27
+ <details >
28
+ <summary ><b >Answer</b ></summary >
29
+ <p >
30
+
31
+ #### Option: B
32
+
33
+ </p >
34
+ </details >
35
+
36
+ </li >
37
+
38
+ ---
39
+
40
+ <li >
41
+
42
+ ** What will be the output ?**
43
+
44
+ ``` js
45
+ let arr = Array .from (Array (10 ).keys ());
46
+ function func (a ) {
47
+ console .log (arguments .length );
48
+ }
49
+ func (arr);
50
+ func (... arr);
51
+ ```
52
+
53
+ - A: ` 10 10 `
54
+ - B: ` 10 1 `
55
+ - C: ` 1 10 `
56
+ - D: ` 1 1 `
57
+
58
+ <br />
59
+
60
+ <details >
61
+ <summary ><b >Answer</b ></summary >
62
+ <p >
63
+
64
+ #### Option: C
65
+
66
+ </p >
67
+ </details >
68
+
69
+ </li >
70
+
71
+ ---
72
+
73
+ <li >
74
+
75
+ ** What will be the output ?**
76
+
77
+ ``` js
78
+ function func (a , b ) {
79
+ arguments [1 ] = 2 ;
80
+ console .log (b);
81
+ }
82
+ func (1 );
83
+ ```
84
+
85
+ - A: ` 2 `
86
+ - B: ` undefined `
87
+ - C: ` 1 `
88
+ - D: ` null `
89
+
90
+ <br />
91
+
92
+ <details >
93
+ <summary ><b >Answer</b ></summary >
94
+ <p >
95
+
96
+ #### Option: B
97
+
98
+ </p >
99
+ </details >
100
+
101
+ </li >
102
+
103
+ ---
104
+
105
+ <li >
106
+
107
+ ** What will be the output ?**
108
+
109
+ ``` js
110
+ var x = 3 ;
111
+ var obj = {
112
+ x: 2 ,
113
+ foo: {
114
+ x: 1 ,
115
+ bar : function () {
116
+ return this .x ;
117
+ },
118
+ },
119
+ };
120
+ var func = obj .foo .bar ;
121
+ console .log (func ());
122
+ console .log (obj .foo .bar ());
123
+ ```
124
+
125
+ - A: ` 3 1 `
126
+ - B: ` undefined 1 `
127
+ - C: ` 1 1 `
128
+ - D: ` 2 1 `
129
+
130
+ <br />
131
+
132
+ <details >
133
+ <summary ><b >Answer</b ></summary >
134
+ <p >
135
+
136
+ #### Option: A
137
+
138
+ </p >
139
+ </details >
140
+
141
+ </li >
142
+
143
+ ---
144
+
145
+ <li >
146
+
147
+ ** What will be the output ?**
148
+
149
+ ``` js
150
+ var foo = function foo () {
151
+ console .log (foo === foo);
152
+ };
153
+ foo ();
154
+ ```
155
+
156
+ - A: ` false `
157
+ - B: ` true `
158
+ - C: ` error `
159
+
160
+ <br />
161
+
162
+ <details >
163
+ <summary ><b >Answer</b ></summary >
164
+ <p >
165
+
166
+ #### Option: B
167
+
168
+ </p >
169
+ </details >
170
+
171
+ </li >
172
+
173
+ ---
You can’t perform that action at this time.
0 commit comments