Skip to content

Commit ea5cca9

Browse files
authored
Merge pull request devkodeio#17 from rajat-mehra05/rajat-questions
added 2 questions in functions.md
2 parents 5aeba4c + 2f47aa0 commit ea5cca9

File tree

1 file changed

+70
-2
lines changed

1 file changed

+70
-2
lines changed

code-snippets/functions.md

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,9 @@ getFunc()();
260260

261261
<li>
262262

263-
**What will be the output ?**
263+
**What is the output ?**
264264

265-
```js
265+
```JS
266266
x = 1;
267267
function func() {
268268
this.x = 2;
@@ -426,4 +426,72 @@ foo();
426426

427427
---
428428

429+
<li>
430+
431+
**What will be the output ?**
432+
433+
```JS
434+
function getAge() {
435+
'use strict';
436+
age = 21;
437+
console.log(age);
438+
}
439+
440+
getAge();
441+
```
442+
443+
- A: `21`
444+
- B: `undefined`
445+
- C: `ReferenceError`
446+
- D: `TypeError`
447+
448+
<br/>
449+
450+
<details>
451+
<summary><b>Answer</b></summary>
452+
<p>
453+
454+
#### Option: C
455+
456+
</p>
457+
</details>
458+
459+
</li>
460+
461+
---
462+
463+
<li>
464+
465+
**What will be the output ?**
466+
467+
```JS
468+
const obj = { 1: 'a', 2: 'b', 3: 'c' };
469+
const set = new Set([1, 2, 3, 4, 5]);
470+
471+
obj.hasOwnProperty('1');
472+
obj.hasOwnProperty(1);
473+
set.has('1');
474+
set.has(1);
475+
```
476+
477+
- A: `false true false true`
478+
- B: `false true true true`
479+
- C: `true true false true`
480+
- D: `true true true true`
481+
482+
<br/>
483+
484+
<details>
485+
<summary><b>Answer</b></summary>
486+
<p>
487+
488+
#### Option: C
489+
490+
</p>
491+
</details>
492+
493+
</li>
494+
495+
---
496+
429497
</ol>

0 commit comments

Comments
 (0)