I would like to parse integers as they are written to a new array. Here are two versions I have:
let aa = '123';
let bb = Array.from(aa, (val) => parseInt(val));
// [1,2,3] OK
let cc = Array.from(aa, parseInt);
// [1, NaN, NaN]
console.log(aa, bb, cc);
Why does the first method work, but the second method does not (doesn't parseInt
take one required argument, so would be the same as the first method?)