#8 Globals are still a bad idea - Lessons Learned While Reading "Effective Javascript"

One of the first things you notice with JS is just how easy it is to pollute the global namespace. Obviously, you should avoid doing that. One little detail worth keeping in mind: Global variables are automatically attached to the global object and can be updated as such.

>var foo = "bar"
undefined
>this.foo = "baz"
"baz"
>foo
"baz"