3 ms·
Because you shouldn't try to be clever with Javascript. Map passes 3 parameter to the mapped function, the second one being an index, and parseInt accepts a se
by throw_m239339 3y ago
Because you shouldn't try to be clever with Javascript.
Map passes 3 parameter to the mapped function, the second one being an index, and parseInt accepts a second optional argument as radix.
be explicit:
["1","2","3"].map(function(x){return parseInt(x,10)})
Javascript isn't the problem here.