Re:Why ['1', '7', '11'].map(parseInt) returns [1, NaN, 3] in...
by ianjsikes on Friday June 21, 2019 @12:18PM
(#20243867)
> Seems intuitive that if parseInt allows omitting the radix parameter, that it should default to whatever radix a standard integer primitive would default to.
But in this case, the radix is _not_ omitted. The map function passes the index of the current iteration as the second parameter to the function it is passed. It is kinda like this:
```
['1','7','11'].map((item, index) => parseInt(item, index))
But in this case, the radix is _not_ omitted. The map function passes the index of the current iteration as the second parameter to the function it is passed. It is kinda like this: ``` ['1','7','11'].map((item, index) => parseInt(item, index))