Skip to content

Commit 5aeba4c

Browse files
authored
Merge pull request devkodeio#13 from vtejaeta/add-hoisting-qns
Add Hoisting question
2 parents 0398f2f + 8931769 commit 5aeba4c

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

code-snippets/hoisting.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,31 @@ foo();
217217
</details>
218218

219219
</li>
220+
221+
---
222+
223+
<li>
224+
225+
**What will be the output ?**
226+
227+
```JS
228+
function animal(){
229+
console.log("Cat");
230+
}
231+
232+
var otherAnimal;
233+
234+
animal();
235+
otherAnimal();
236+
237+
otherAnimal = function() {
238+
console.log("Dog");
239+
}
240+
```
241+
242+
- A: `Cat Dog`
243+
- B: `Cat undefined`
244+
- C: `Cat TypeError: otherAnimal is not a function`
220245

221246
---
222247

@@ -246,10 +271,12 @@ console.log(a,b);
246271
<summary><b>Answer</b></summary>
247272
<p>
248273

274+
#### Option: C
249275
#### Option: A
250276

251277
</p>
252278
</details>
253279

280+
</li>
254281
</li>
255-
</ol>
282+
</ol>

0 commit comments

Comments
 (0)