1

Output from Node.js repl:

> ["1", "2"].map(i => parseInt(i)); // correct
[ 1, 2 ]
> ["1", "2"].map(i => i); // correct
[ '1', '2' ]
> ["1", "2"].map(parseInt); // what is causing the NaN?
[ 1, NaN ]

Should not the last result be [1, 2]?

Version:

$ node --version
v6.9.1
Jonny Heggheim
  • 1,423
  • 1
  • 12
  • 19
  • What is the signature of parseInt? What gets passed to map callbacks? Do you see the issue? I believe you're providing an invalid radix if I remember right. – zero298 Oct 29 '16 at 20:12

0 Answers0