var foo = "test"; if(true) { alert(foo); // Interviewer: "What does this alert?" Answer: "test" var foo = "bar"; } alert(foo); // "bar" Interviewer: Why is that? Answer: Because JavaScript does not have block scope