In Javascript, there is something called the Global scope. On Browsers, the global scope object is window
. If you create a variable outside of a function, it goes by default into the global scope, which is window.
When invoking a method or referencing a variable on the window object, it's optional to include window
.