In reviewing parseInt(string, radix)
in:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt
all 13
examples make perfect sense except for this one.
According to one example, parseInt(015, 10)
will return 13
. This makes sense assuming that numericals that begin with 0 are treated as an octal, regardless of the 10
that appears in the radix position.
So if the octal is specified as it is in the question header:
parseInt(021, 8)
Then why wouldn't this be 17
(vs. 15
per the Mozilla documentation and in my tests in jsfiddle?
Any insight would be appreciated.