[X]

null and undefined

luljs still works

The two empty values are loosely equal but strictly different.

In 2026: Still works. null == undefined is true by a special rule in the == algorithm; the two are the language's two ways of saying nothing. But they are different types, so null === undefined is false, and typeof null is "object" while typeof undefined is "undefined".

Where it came from: The == algorithm has a clause making null and undefined equal to each other and nothing else, as MDN's null page notes. MDN

<script>
document.write('<p><code>null == undefined</code> is <b>' + (null == undefined) + '</b></p>');
document.write('<p><code>null === undefined</code> is <b>' + (null === undefined) + '</b></p>');
document.write('<p><code>typeof null</code> is <b>"' + (typeof null) + '"</b>, <code>typeof undefined</code> is <b>"' + (typeof undefined) + '"</b></p>');
</script>
sandboxed demo · breaks nothing but itselfrestart

More in luljs

all 63 in luljs › · the whole library ›