This page is not yet available in Spanish. We are working on its translation. If you have any questions or feedback about our current translation project, feel free to reach out to us!
Metadata
ID:javascript-code-style/radix
Language: JavaScript
Severity: Notice
Category: Best Practices
Description
When utilizing the parseInt() function, many often skip the second parameter (the radix), allowing the function to deduce the number type based on the initial argument. By default, parseInt() can recognize both decimal and hexadecimal numbers, the latter through the 0x prefix. However, before ECMAScript 5, the function also mistakenly recognized octal numbers, leading to issues as many developers presumed a starting 0 would be disregarded.