|
|
|
|
|
by emehrkay
4182 days ago
|
|
The first one is easy to understand though. parseInt takes two arguments: $thing_to_change and $radix; map iterates over an array and feeds it $value and $index. You're getting parseInt("10", 0); parseInt("10", 1) and parseInt("10", 2); The fix would be to partially apply parseInt with your defined radix; var foo = ["10", "10", "10"];
var base10 = function(val){
return parseInt(val, 10);
};
x = foo.map(base10)
[10, 10, 10]
|
|