In the answers to this question, we read that function f() {} defines the name locally, while [var] f = function() {} defines it globally. That makes perfect sense to ...
function f() {}
[var] f = function() {}
Can someone explain why the alert returns "undefined" instead of "hello"?
window.onload = function() { var a = 'hello'; alert(window.a); }