Question
What will be the output?
function test(){
console.log(a);
var a = 5;
}
test();
Answer
Output: undefined
Inside the function, var a is hoisted and initialized with undefined before execution.
Key Points
This question tests your understanding of JavaScript internals and execution behavior. Interviewers often ask similar variations to evaluate debugging and reasoning skills.