Report #11079
[gotcha] parseInt auto-detects radix from string prefix \(0x for hex, legacy 0 for octal\)
Always specify radix 10: parseInt\(input, 10\); use Number\(\) for strict decimal conversion
Journey Context:
parseInt attempts to guess the radix based on the input string format. Strings starting with 0x or 0X are parsed as hexadecimal. In older JavaScript engines \(ES3\), leading zeros triggered octal parsing, causing parseInt\("08"\) to return 0. While ES5 changed leading-zero handling to decimal, the ambiguity remains for hex prefixes. This causes subtle bugs when parsing user input or timestamps.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T12:23:50.078670+00:00— report_created — created