-
What will be the output ?
console.log(typeof foo); function foo() { return "bar"; } var foo = "bar";
- A:
undefined - B:
string - C:
function
- A:
-
What will be the output ?
function foo() { return "bar"; } var foo; console.log(typeof foo);
- A:
undefined - B:
string - C:
function
- A:
-
What will be the output ?
if (true) { function foo() { console.log(1); } } else { function foo() { console.log(2); } } foo();
- A:
1 - B:
2
- A:
-
What will be the output ?
function foo() { bar(); return; function bar() { console.log("bar"); } } foo();
- A:
undefined - B:
bar - C:
Uncaught ReferenceError: bar is not defined
- A:
-
What will be the output ?
function foo(x) { x(); function x() { console.log("foo"); } } foo(function() { console.log("bar") });
- A:
foo - B:
bar - C:
Uncaught ReferenceError: x is not defined
- A:
-
What will be the output ?
foo(); function foo() { console.log(1); } var foo = function() { console.log(2); }; function foo() { console.log(3); } foo();
- A:
3 3 - B:
3 2 - C:
1 2 - D:
1 3
- A:
-
What will be the output ?
function animal(){ console.log("Cat"); } var otherAnimal; animal(); otherAnimal(); otherAnimal = function() { console.log("Dog"); }
- A:
Cat Dog - B:
Cat undefined - C:
Cat TypeError: otherAnimal is not a function
- A:
-
What are the logged values of a and b ?
b = function a(){}; var a = b = 6; a = function b(){}; function b() {}; function a() {}; console.log(a,b);
- A:
ƒ b(){} 6 - B:
ƒ a(){} 6 - C:
ƒ b(){} ƒ a(){} - D:
ƒ a(){} ƒ b(){} - E:
6 ƒ a(){} - F:
6 ƒ b(){}
- A:
-
What are the logged values of a and b ?
var a = 10; console.log("line number 2", a); function fn() { console.log("line number 4", a); var a = 20; a++; console.log("line number 7", a); if (a) { var a = 30; a++; console.log("line number 11", a); } console.log("line number 13", a); } fn(); console.log("line number 2", a);
- A:
line number 2 10 line number 4 10 line number 7 21 line number 7 31 line number 13 31 line number 2 31
- B:
line number 2 10 line number 4 undefined line number 7 21 line number 11 31 line number 13 31 line number 2 10
- C:
line number 2 10 line number 4 10 line number 7 21 line number 11 31 line number 13 31 line number 2 10
-
What will be the output?
function foo() { let a = b = 0; a++; return a; } foo(); console.log(typeof a); console.log(typeof b);
- A:
number \n number - B:
undefined \n number - C:
undefined \n undefined - D:
number \n undefined
- A: