1

Since map callback gets called on each element, I would have expected [2,3] as the return value based on the documentation here.

PDN
  • 711
  • 1
  • 11
  • 29

1 Answers1

1

Simply use .map(Number) for this type of task:

var a = ["2", "3"];

var b = a.map(Number);
omarjmh
  • 12,842
  • 6
  • 30
  • 41