What is the output?
const x = ['1', '2', '3'].map(parseInt); console.log(x);
- [1, NaN, NaN]
- [1, 2, 3]
- [NaN, NaN, NaN]
- [1, 2, NaN]
map passes the index as parseInt's radix, so it parses in base 1 and base 2.
Play Problem Solving ▸
const x = ['1', '2', '3'].map(parseInt); console.log(x);