I am trying to remove some javascript code, and one of the steps removes all useless (or simple incorrect) global variables that slip from errors like:
for (prop in obj) { ...
instead
for (var prop in obj) { ...
JSLint helps to understand this muck a little, but it is not 100% reliable when muck happens during the work. I already tried to add some control code that regularly checks the global area to the console if some new variable is found , and this helped a little, but when it tells me that a new global variable named "I" was found .. ... well, this is a mess figuring out where it happened in thousands of lines of code.
So here we are: is there a better way / tool / script / everything to find small pests? My dream is something like a Firebug plugin that stops execution whenever a new global variable is created ...
Thanks!
source share