I ran JSLint on this JavaScript code and it said:
Problem at line 32 character 30: Missing radix parameter.
This is the code in question:
imageIndex = parseInt(id.substring(id.length - 1))-1;
What is wrong here?
I ran JSLint on this JavaScript code and it said:
Problem at line 32 character 30: Missing radix parameter.
This is the code in question:
imageIndex = parseInt(id.substring(id.length - 1))-1;
What is wrong here?
You can turn off this rule if you wish to skip that test.
Insert:
Under the "
rules
" property in thetslint.json
file.It's not recommended to do that if you don't understand this exception.
Just put an empty string in the radix place, because parseInt() take two arguments:
parseInt(string, radix);
string The value to parse. If the string argument is not a string, then it is converted to a string (using the ToString abstract operation). Leading whitespace in the string argument is ignored.
radix An integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the above-mentioned string. Specify 10 for the decimal numeral system commonly used by humans. Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. Different implementations produce different results when a radix is not specified, usually defaulting the value to 10.
imageIndex = parseInt(id.substring(id.length - 1))-1;imageIndex = parseInt(id.substring(id.length - 1), '')-1;