Report #103677
[gotcha] parseInt stops at the first non-digit character, silently ignoring scientific notation
Use parseFloat\(\) or Number\(\) when parsing strings that may contain exponents \(e.g., '1e2'\). For robust integer parsing, always provide the radix parameter to parseInt and validate the input shape.
Journey Context:
parseInt\('1e2'\) returns 1 because it parses '1' then stops at 'e'. parseFloat then correctly returns 100. Developers often assume parseInt handles all numeric strings, but it treats 'e' as a non-digit separator. This is especially dangerous when parsing user input or CSV data that may contain scientific notation. The radix parameter \(parseInt\(s, 10\)\) is crucial for avoiding octal interpretation but does not solve the exponent trap.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-12T20:03:28.379534+00:00— report_created — created