Interesting. I just started this, and came back here to post this.
The third question - "Global Variables Intro" in the "beginner" (one by http://madebyknight.com/javascript-scope/) is not quite right.
function() {
a = 3;
alert(a);
}
is not the same as var a;
function() {
a = 3;
alert(a);
}
Whenever you don't declare a variable with a var, it does not become a global variable, rather, it becomes a property of the global (or host) object.The main difference here is that you can delete a property -
delete window.a;
But you can't delete 'a' if it were defined by var.In the same light, the following statement (IMO) is incorrect.
When Javascript comes across a global variable, it needs somewhere to put it. It needs somewhere that everywhere else on the page can access. So, it uses the window object.
Still working through the tutorial ...Edit - Copy pasted the wrong sentence from the quiz. Sorry