Re:Hide this in your coworkers' JavaScript code tomorrow
by zupa-hu on Monday March 31, 2014 @10:15AM
(#7501560)
It is only harmful if the developer actually used the variable as a side effect, aka relied on it outside the current scope.
By making the global variable local to the scope around the if statement, side-effects won't escape the local scope (as said, the if block does not declare a new scope).
By making the global variable local to the scope around the if statement, side-effects won't escape the local scope (as said, the if block does not declare a new scope).