Cette page n'est pas encore disponible en français, sa traduction est en cours. Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.
Metadata
ID:typescript-code-style/radix
Language: TypeScript
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.