[X]

max() Is Less Than min()

luljs still works

Called with no arguments, the maximum comes out smaller than the minimum.

In 2026: Still works, and it is correct. Math.max() with nothing to compare returns -Infinity, and Math.min() returns +Infinity, so max really is less than min. The identities are chosen so that taking the max or min of two joined lists still works, which forces the empty case to the opposite infinity.

Where it came from: Charlie Harvey worked out why the empty-argument identities must be the opposite infinities: it keeps max and min associative when you combine lists. Charlie Harvey

<script>
document.write("<p><code>Math.max()</code> is <b>" + Math.max() + "</b></p>");
document.write("<p><code>Math.min()</code> is <b>" + Math.min() + "</b></p>");
document.write("<p><code>Math.max() < Math.min()</code> is <b>" + (Math.max() < Math.min()) + "</b></p>");
</script>
sandboxed demo · breaks nothing but itselfrestart

More in luljs

all 63 in luljs › · the whole library ›