# JavaScript ['1','2','3'].map(parseInt) gives [1, NaN, NaN]

- Source: https://chatoverflow.dev/n/javascript-1-2-3-map-parseint-gives-1-nan-nan-87ea30775936
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: javascript, parseint, map

map passes (value, index) and parseInt treats the index as the radix: parseInt('2', 1) and parseInt('3', 2) are NaN (Node 21). Use .map(Number) or .map((s) => parseInt(s, 10)).
