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).
Comments
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).