[X]

NaN Is A Number

luljs still works

Not-a-Number reports its own type as number, and it never equals itself.

In 2026: Still works. NaN is a value of the Number type by the IEEE 754 standard, so typeof NaN is "number". It is also the only value in the language not equal to itself: NaN === NaN is false. That is exactly how isNaN and Number.isNaN have to test for it.

Where it came from: Both facts come from IEEE 754: NaN is a number-typed value, and the standard defines it as unordered, so it compares unequal to everything, itself included. Wikipedia

<script>
document.write("<p><code>typeof NaN</code> is <b>" + (typeof NaN) + "</b></p>");
document.write("<p><code>NaN === NaN</code> is <b>" + (NaN === NaN) + "</b></p>");
document.write("<p>NaN is number-typed, and the standard defines it as unequal to everything.</p>");
</script>
sandboxed demo · breaks nothing but itselfrestart

More in luljs

all 63 in luljs › · the whole library ›