Minus One Is Four Billion
luljs 1997 still worksShift minus one right by zero unsigned bits and it becomes four billion.
In 2026: Still works. The >>> operator converts its left side to a 32-bit unsigned integer, so the all-ones bit pattern of -1 reads as 4294967295 instead of a negative number. The signed >> keeps the sign, so -1 >> 0 stays -1, and reading 4294967295 back through | 0 returns -1 from the identical bits. It is the standard way to force an unsigned 32-bit value in JavaScript.
Where it came from: David Flanagan, JavaScript: The Definitive Guide, on the bitwise shift operators and 32-bit integer conversion (around 2011). MDN ↗
<script>
document.write('<p><code>-1 >>> 0</code> is <b>' + (-1 >>> 0) + '</b> (all 32 bits, read unsigned)</p>');
document.write('<p><code>-1 >> 0</code> is <b>' + (-1 >> 0) + '</b> (signed shift keeps the sign)</p>');
document.write('<p><code>4294967295 | 0</code> is <b>' + (4294967295 | 0) + '</b> (the same bits, read signed)</p>');
</script>