I want it to parse to integers a String's array that had the id's from a selected html element, so I use this code:
var x = ["1", "2","3","4","5"];
var y = x.map(parseInt);
I was expecting:
[1,2,3,4,5]
But instead I get:
[1,NaN,NaN,NaN,NaN]
If I change it to this other ways it works as expected:
var z = x.map(function(item){return parseInt(item)});
var q = x.map(Number);
You can see it the same behavior on safari, chrome and firefox live here: jsfiddle.net: Error on Map(parseInt)
So my question is: Is this a bug or a feature?