The Leading Zero That Meant Octal
luljs 1999 still worksA number written with a leading zero was read in octal, so 010 is 8 and 0755 is 493.
In 2026: Still works in sloppy mode. A numeric literal with a leading zero was read as octal, so 010 is 8 and 0755 is 493, the old Unix file-permission value. ECMAScript 5 strict mode made these a SyntaxError, and the modern replacement is the explicit 0o prefix. A digit of 8 or 9 voids the octal reading and falls back to decimal, so 09 is just 9.
Where it came from: Nicholas Zakas, Professional JavaScript for Web Developers, on octal and hexadecimal literals and the strict-mode ban (around 2012). MDN ↗
<script>
document.write('<p><code>010</code> is <b>' + 010 + '</b> (a leading zero once meant octal)</p>');
document.write('<p><code>0755</code> is <b>' + 0755 + '</b> (the old file-permission octal)</p>');
document.write('<p>In strict mode <code>010</code> is a <b>SyntaxError</b>: legacy octal literals were banned.</p>');
</script>