[X]

typeof null

luljs still works

The type of nothing is "object", a bug baked in during JavaScript's first ten days.

In 2026: Still works, and it will never be fixed. In the original 1995 engine, every value carried a type tag in its low bits, and the tag for objects was 000. null was the machine null pointer, all zero bits, so typeof null read as "object". Brendan Eich has called it a bug; a fix was proposed and rejected because too much code relies on it.

Where it came from: Traced to Brendan Eich's original ten-day implementation of JavaScript in 1995, where null's zero pointer collided with the object type tag. Alexander Ellis documents the bit-level history. Alexander Ellis

<script>
document.write("<p><code>typeof null</code> is <b>" + (typeof null) + "</b></p>");
document.write("<p><code>typeof undefined</code> is <b>" + (typeof undefined) + "</b></p>");
document.write("<p>null's all-zero bits matched the object type tag in the 1995 engine.</p>");
</script>
sandboxed demo · breaks nothing but itselfrestart

More in luljs

all 63 in luljs › · the whole library ›