0 === -0 is true because 0 doesn't have sign
NaN === NaN is false because, according to IEEE 754 specifications any operation performed on NaN values should yield a false value or should raise an error.
-0 does in fact have a sign:
-0
en.wikipedia.org/wiki/IEEE_754
Moreover, there are two zero values, called signed zeros: the sign bit specifies whether a zero is +0 (positive zero) or −0 (negative zero).
That same Wikipedia article specifies that 0 and -0 should compare as equal.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
0 === -0 is true because 0 doesn't have sign
NaN === NaN is false because, according to IEEE 754 specifications any operation performed on NaN values should yield a false value or should raise an error.
-0
does in fact have a sign:en.wikipedia.org/wiki/IEEE_754
Moreover, there are two zero values, called signed zeros: the sign bit specifies whether a zero is +0 (positive zero) or −0 (negative zero).
That same Wikipedia article specifies that 0 and -0 should compare as equal.