Get to know MDN better
The JavaScript strict mode-only exception "0-prefixed octal literals are deprecated; use the "0o" prefix instead" occurs when deprecated octal literals (0 followed by digits) are used.
SyntaxError in strict mode only.
Octal literals are deprecated. When you prefix a decimal integer with 0, you actually change it to an octal literal, which may be surprising. The standardized syntax uses a leading zero followed by a lowercase or uppercase Latin letter "O" (0o or 0O).
Leading zeros are always forbidden, even when the literal is not valid octal literal syntax (such as when the literal contains the digits 8 or 9, or it has a decimal point). A number literal may only start with 0 if that 0 is its units place.
Use a leading zero followed by the letter "o" or "O":
This page was last modified on Jul 8, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.