When using JSLint or JSHint, you will get the "Missing radix parameter" error when using parseInt without a second argument.

Fix the radix error

I hadn’t heard of ‘radix’ before coming across this error during linting. The dictionary defines it as “the base of a system of numbers, such as 2 in the binary system and 10 in the decimal system.” What this means to JavaScript is that you should indicate whether a passed number is decimal or hexidecimal.

You should always pass a “radix” parameter with parseInt.

The usage is parseInt(string, radix).

JavaScript assumes the following if you don’t pass a value:

  • 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.

Radix error

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.