So I am trying to convert an array of strings to an array of numbers using the following code.
let a = ["0", "0"];
let b = Array.from(a, parseInt);
console.log(b);
and what I get is
b = [0, NaN];
I am familiar with a similar issue using Array.map()
since it provides three arguments to parseInt()
and the second argument (index) is interpreted as a radix by parseInt()
. But it shouldn't be the case for Array.from()
.
Can someone give me an explanation please?