Also, something that he doesn't note, but that's important if you're writing production code, is that implied globals (like his examples) are syntax errors in strict mode.
Sorry, I should make that clear. Globals are unavoidable to some degree, unless you are assigning no names to anything at all. :) But I try to use globals only where it makes sense, eg for namespaces and other top-level containers.
2
u/dangoodspeed Feb 23 '13
He says you should never ever have a global variable or global function. Do other people agree with that?