Take a look at this experiment conducted on jsconsole.com
> parseInt("00")
0
> ["00"].map(parseInt)
Array (1)[ 0 ]
> ["123", "00"].map(parseInt)
Array (2)[ 123,NaN ]
> ["00", "123"].map(parseInt)
Array (2)[ 0,NaN ]
I've stumbled upon this by trying to do some date-time parsing. The problem seemed to be the fact that I didn't specify which integer base I want. Using parseInt(x, 10) solves my problem but could someone explain to me how ["00"].map(parseInt) and ["123", "00"].map(parseInt) could possibly differ for the value of "00"? I might be missing something extremely obvious here, but if I'm not this would mean that there's something wrong with Array.prototype.map or parseInt or both.
Thanks in advance.
It has to do with the extra parameters map adds to the method call. Try the following snippet to get the correct results. This prevents parseInt from receiving them.
console.log(["123", "00"].map(it=>parseInt(it)))