"NaN Comparison Always Returns False" in JavaScript — What It Means and How to Fix It

What the JavaScript error "NaN Comparison Always Returns False" means and how to fix it.

Published October 30, 2026

"NaN Comparison Always Returns False" is reflects that NaN is the only JavaScript value that is never equal to itself, including in comparisons with itself.

Key points

  • Use Number.isNaN(value) to correctly check whether a value is NaN, instead of value === NaN which always evaluates to false
More JavaScript articles