4 ms·
Well in this case, the original author was relying on '0' == 0 for their code to work. Even if you were dead set against using strict equality (which is silly,
by magicalist 13y ago
Well in this case, the original author was relying on '0' == 0 for their code to work. Even if you were dead set against using strict equality (which is silly, but whatever), the code is still disingenuous and should have tested index == '0' to make its intent clear. There's no other value that they could have being relying on it to coerce without some other very nasty things going on.
> overzealous developers might accidentally break your code trying to be proactive
It's not just people changing your code, it's people trying to read your code (including you, months later).