Oh, JavaScript, you silly sausage…

> NaN === NaN

> typeof NaN


* NaN stands for “not a number”


@aral NaN !== NaN is specified behaviour for IEEE floating point numbers, though, so that one's not JS' fault

@jack Well, heck, can we at least agree it’s someone’s fault? :)

It’s hard to make a case for x !== x

@aral @jack It's hard to make a case for Inf == Inf or NaN == NaN too.
@aral @jack

$ node
> Infinity == Infinity

And I can say that and still find faults with JS. 😁
Of course, that's not JS's fault either. IEEE-754 1.2.5 draft:

> Every NaN shall compare unordered with everything, including itself. Comparisons shall ignore the sign of zero (so +0 = −0). Infinite operands of the same sign shall compare equal.


@clacke @aral btw if you want to have some fun with NaN and Inf, this is worth a watch: youtube.com/watch?v=5TFDG-y-EH

Sign in to participate in the conversation

My home on the Fediverse.