Question
What will be the output?
var a = 1;
function demo(){
console.log(a);
var a = 2;
}
demo();
Answer
Output: undefined
Function scope hoisting overrides outer scope variable access.
Key Points
This question tests your understanding of JavaScript internals and execution behavior. Interviewers often ask similar variations to evaluate debugging and reasoning skills.