Why is abc undefined in first output, then printed out in the final console.log ? I would expect hello world hello...
var abc = 'hello';
function test() {
console.log(abc);
var abc = "world";
console.log(abc);
}
test();
console.log(abc);