Add the the radix to all parseInt()
calls. Else JS will recognize "08" as being base 8, where "8" is an invalid character and thus wont be parsed.
parseInt( '08' ) == 0
parseInt( '08', 10 ) == 8
If the input string begins with "0x" or "0X", radix is 16 (hexadecimal) and the remainder of the string is parsed.
If the input string begins with "0", radix is eight (octal) or 10 (decimal). Exactly which radix is chosen is implementation-dependent.
ECMAScript 5 specifies that 10 (decimal) is used, but not all browsers support this yet. For this reason always specify a radix when using parseInt.
If the input string begins with any other value, the radix is 10 (decimal).