JavaScript hoisting and scope output prediction
Filed under Infoedge
The question
Determine the output of a JavaScript snippet involving var hoisting inside a function: var x = 10; function foo() { alert(x); var x = 20; } foo();
No write-up yet. Related questions below have one.
Related Infoedge questions
Collected from public candidate posts and coding forums. Updated Nov 2026.