4 ms·
probably because NaN has a specific meaning when the value being considered is a number, which "LOL" isn't. If you're calling isNaN, it usually means you're che
by nemo1618 11y ago
probably because NaN has a specific meaning when the value being considered is a number, which "LOL" isn't. If you're calling isNaN, it usually means you're checking explicitly for a number like 1/0, not a string. So really this is a matter of types.
Personally I don't see how this solves much, but then again I'm not a JavaScript guy.
- robocat 11y agoIronically enough, 1/0 is Infinity, which is a valid number, instead you need to use 0/0 to get NaN. Even worse, the rules for NaN aren't specific to JavaScript, but come from the IEEE 754 floating point standard. Standard NaN is even weirder: http://en.m.wikipedia.org/wiki/NaN http://en.m.wikipedia.org/wiki/NaN