Question 10
Back to Exercise
What does the following JavaScript code print (console output, as in Node.js)?
function test() {
console.log(typeof x);
var x = 10;
function x() {}
console.log(typeof x);
}
test();
- A function number Correct
- B undefined number
- C number function
- D function function
Correct Answer: Option A
Creation phase: x is the function. Execution phase: var x = 10 assigns a number; the function declaration line itself does nothing at run time.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!