3 ms·
A useful function function overValues(f) { return function(x) { return f(x); } } Then you can do ['10', '10', '10'].map(overValues(parseInt)); Howev
by ajanuary 13y ago
A useful function
function overValues(f) { return function(x) { return f(x); } }
Then you can do
['10', '10', '10'].map(overValues(parseInt));
However, usually you're going to want to do the equivalent of this
['0101', '032'].map(function(s) { return parseInt(s, 10); })
Because Javascript interprets a leading zero as an indicator of base.
- nollidge 13y agoI think you accidentally a word... > as an indicator of base. As an indicator of base 8 (octal).