$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · hard · #79

What is the output?

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