2 ms·
See the MDN section on "confusing special case behavior"[1] for why they probably didn't want to use the global version of isNaN. Number.isNaN handles those cas
by Ajedi32 5y ago
See the MDN section on "confusing special case behavior"[1] for why they probably didn't want to use the global version of isNaN. Number.isNaN handles those cases better but is not as widely supported.
[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN#confusing_special-case_behavior https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- jazzyjackson 5y agoThanks for this, I had forgot that empty strings get coerced to 0... interesting choice.