I have met this strange issue.
Why is so?! Should it be so?
I have met this strange issue.
Why is so?! Should it be so?
From the MDN docs for isNaN
:
Unlike all other possible values in JavaScript, it is not possible to rely on the equality operators (== and ===) to determine whether a value is NaN or not, because both NaN == NaN and NaN === NaN evaluate to false. Hence, the necessity of an isNaN function.
use isNaN
instead.
that's why we use
isNaN(x)
it seems that x is a NaN object and it does not compare equal to another