-
Which variables end up being part of
func's
closure ?var c = 10; function foo(a){ let b = 8; const d = 10; return function bar(){ return a + d + c; } } const func = foo(7);
- A:
a and d
- B:
a,b and d
- C:
a,b,c and d
- D:
a,d and c
- A:
-
What will be the output ?
const fn = () => { a = 2; console.log(a); } fn();
- A:
undefined
- B:
2
- C:
Uncaught ReferenceError: a is not defined
- A:
-
What will be the output ?
for (var i = 0; i < 4; i++) { setTimeout(() => console.log(i), 0) }
- A:
0 1 2 3
- B:
4 4 4 4
- A:
-
What will be the output?
for(let i = 0; i < 5; i++){ setTimeout(() => console.log(i), 1); }
- A:
0 0 0 0 0
- B:
1 2 3 4 5
- C:
5 5 5 5 5
- D:
0 1 2 3 4
- A:
-
What will be the output?
let count = 0; (function immediate() { if (count === 0) { let count = 1; console.log(count); } console.log(count); })();
- A:
0 0
- B:
1 1
- C:
1 0
- D:
0 1
- A:
-
what would be the typeof a and typeof b
function foo() { let a = b = 0; a++; return a; } foo(); console.log(typeof a) console.log(typeof b)
- A:
Number Number
- B:
Number undefined
- C:
undefined Number
- D:
not define not define
- A: