|
|
|
|
|
by jakear
1220 days ago
|
|
map passes the index as the second argument to the mapping function, parseInt accepts the second input as the base. So the result is [10 (0 is treated as 10), NaN (base 1 doesn't work), 2 ("10" in base 2 is 2)]. You can try ["10","10","10"].map(console.log) for more info... the third argument is the source array: > 10 0 ['10', '10', '10']
> 10 1 ['10', '10', '10']
> 10 2 ['10', '10', '10']
|
|