When using JSLint or JSHint, you will get the
"Missing radix parameter" error when using parseInt without a second argument.
Fix the radix error
You should always pass a “radix” parameter with parseInt.
The usage is
- If string begins with “0”, radix = 8 (octal). * deprecated *
- If string begins with “0x”, radix = 16 (hexadecimal)
- If string begins with any other value, radix = 10 (decimal)
When parsing a standard integer, like when working with CSS values, simply pass 10 as the 2nd argument.
Supress the error in JSHint
There are a couple ways to suppress these errors if you really have to (maybe some legacy code has a lot of parseInt calls, for instance).
You can add
/*jshint -W065 */ to the top of your JS file. This will tell JSHint to suppress radix warnings.
You can also use
"-W065": true in a .jshintrc configuration file.