3 ms·
That's an unreasonable, excessive use of defensive programming. We're not talking about an unstable API here, we're talking about an operator. It would be jus
by mark_and_sweep 7y ago
That's an unreasonable, excessive use of defensive programming.
We're not talking about an unstable API here, we're talking about an operator.
It would be just as unreasonable to "defend" your code against `1 + 1` suddenly returning a boolean rather than a number.
- Raphmedia 7y agoYou already know that ìn` will return either `true` or `false`. Why use `==` which will convert data instead of `===` which will test for a boolean directly? Ignore the symbols and use the words. Which makes more sense to you? "[My test] strictly equals true." or "[My test] loosely equals true."
- wereHamster 7y agoThis looks future proof to me: `if (JSON.stringify("something" in foo).match(/t/) != null) { … }`