@nzakas thank you! Good to know. I always have a problem with the NaN name, I would better call it undefinedNumber, like in math. But, we can't change IEEE 754. I guess.
Conversation
Notices
-
Embed this notice
Sergey on FunctionalScript (functionalscript@techhub.social)'s status on Thursday, 25-Jan-2024 04:41:20 JST Sergey on FunctionalScript -
Embed this notice
Nicholas C. Zakas (nzakas@fosstodon.org)'s status on Thursday, 25-Jan-2024 04:41:22 JST Nicholas C. Zakas JavaScript tip: Number.isNaN() is not the same as isNaN().
Number.isNaN() checks if the value is exactly equal to NaN:
Number.isNaN(NaN) === true;
Number.isNaN("foo") === false;isNaN() checks if the value isn't a number:
isNaN(NaN) === true;
isNaN("foo") === true;
-
Embed this notice