What is JSlint error "missing radix parameter" in JavaScript?

JavascriptFront End TechnologyObject Oriented Programming

The parseInt function available in JavaScript has the following signature −

parseInt(string, radix);

Where the parameters are the following −

string − The value to parse. If this argument is not a string, then it is converted to one using the ToString method. Leading whitespace in this argument is ignored.

radix − An integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the string.

If the radix parameter is omitted, JavaScript assumes the following −

  • If the string begins with "0x", the radix is 16 (hexadecimal)

  • If the string begins with "0", the radix is 8 (octal). This feature is deprecated

  • If the string begins with any other value, the radix is 10 (decimal)

In order to avoid the above magic, JShint gives an error.

Published on 27-Nov-2019 09:42:45