Programming, Economics, Finance, Technology, Art
parseInt("07") // => 7 parseInt("08") // => NaN
Starting a numeric string with a zero marks it as being in oct format?
You should always supply a base number as the second argument when using parseInt() - base 10 in this instance. You can never rely on it being accurate 100% of the time especially if the user can input the string.
2 comments: