NaN !== NaN: The Only Value That Isn’t Equal to Itself

📰 Medium · JavaScript

Learn why NaN is the only value in JavaScript that isn't equal to itself and how to handle it

beginner Published 12 Apr 2026
Action Steps
  1. Check for NaN using the isNaN() function
  2. Use the Object.is() method to compare values
  3. Test the inequality of NaN with itself using the !== operator
  4. Apply the knowledge to handle NaN in numerical computations
  5. Compare the behavior of NaN with other special values like Infinity and -Infinity
Who Needs to Know This

Developers and programmers working with JavaScript will benefit from understanding this unique property of NaN to avoid unexpected errors in their code

Key Insight

💡 NaN stands for Not a Number and is a special value in JavaScript that represents an invalid or unreliable result in numerical computations

Share This
Did you know NaN is the only value in JavaScript that isn't equal to itself?
Read full article → ← Back to Reads