ExterminateGlobals.JS 9 September, 2013

ExterminateGlobals.JSUnwanted globals can sneak into your JS codebase quite quickly, all you need to do is forget that pesky `var`. That can off course introduce all sorts of trouble to your code base. If you’re lucky you’ll just be a bit embarrassed when your co-worker finds the global. But if you’re unlucky, that global can cause all sorts of bugs through your code base.

That’s why I’ve created this JavaScript utility that will tell you if you have any unwanted globals (as opposed to the globals you create intentionally, such as third party libraries). Once you use it will generate a nice report inside your browser’s console which will hopefully help your code base be unwanted globals free.

You can find&fork the code here on GitHub. Everything you need to know is included in the readme file, and since it’s MIT licensed feel free to do with the code as you please.

If you wish to discuss this post please use twitter or contact me.