SAMEER KUMAR MAURYA’s Post

💡 JavaScript Trivia: Did you know that in JavaScript, the expression NaN === NaN actually returns false? 🤯 That’s because NaN (Not-a-Number) is special — it’s not equal to anything, not even itself. This behavior follows the IEEE 754 standard for floating-point numbers. So if NaN isn’t equal to itself, how do we check for it? That’s where isNaN() and Number.isNaN() come in. The older isNaN() function tries to convert the value into a number before checking, which can give confusing results — for example, isNaN('hello') returns true because the string can’t be turned into a number. The newer Number.isNaN() is smarter and stricter: it only returns true when the value is literally NaN, not just something that can’t be converted to a number. ✅ Best practice: use Number.isNaN() whenever possible — it’s more predictable and avoids type coercion headaches. A tiny quirk, but one that’s tripped up many JavaScript devs (including me at some point 😅). #JavaScript #WebDevelopment #CodingTips #Programming #Trivia #Fact

  • text

Because javascript is built in just 15 days so this is a bug 🪲

Because every variable have there own memory storages, both two similer NaN have same datatype value but different memory storages

Like
Reply

NaN is an invalid number, and an invalid number is not equal to anything but not itself

Like
Reply

Becouse NaN is Never Equal to anything, even, itself

not define i= not define

Like
Reply
See more comments

To view or add a comment, sign in

Explore content categories