Re:Stage 3 Proposal: Array.prototype.at
by Fatalist_ma on Thursday June 03, 2021 @12:25PM
(#27383673)
There's nothing broken about parseInt. The problem is, it can take a second argument(radix), and .map will feed it current item's index as the second argument(and the whole array as the third, but that one will get ignored).
const arr = ['1','2','3'];
arr.map(parseInt) is equivalent to: [
parseInt('1', 0, arr),
parseInt('2', 1, arr),
parseInt('3', 2, arr)
];
const arr = ['1','2','3']; arr.map(parseInt) is equivalent to: [ parseInt('1', 0, arr), parseInt('2', 1, arr), parseInt('3', 2, arr) ];