Globalne promenljive se kače na window objekat. Mali test:
Kôd:
var global_variable = 12;
var some_function = function() {
global_from_function = 13;
var local = 14;
console.log(window.global_variable);
console.log(window.global_from_function);
console.log(window.local);
}();
Vraća:
> 12
> 13
> undefined
Edit: LOL! Koliko odgovora