Given the following:
> '10.0.0.1'.split('.').map(parseInt)
[10, NaN, 0, 1]
Why isn't the output instead:
[10, 0, 0, 1]
Despite the following holding true:
> x = '10.0.0.1'.split('.');
["10", "0", "0", "1"]
> x[1] == x[2]
true
Alternatively using parseFloat
does give me the desired output; however I feel I am missing something crucial here.
EDIT: '10.0.0.1'.split('.').map(function(x) { return parseInt(x); })
works as expected.
EDIT2: I am using the Chrome Version 26.0.1410.64, but this also occurs in my local copy of node.js.