6

I'm trying to create an array of zeroes and I can get the desired result by using:

Array.apply(null, Array(9)).map(Number.prototype.valueOf, 0)

but I get the wrong thing if I use:

new Array(9).map(Number.prototype.valueOf, 0)

And for that matter any attempt to map on the result of new Array(len) fails to return the expected array on a mapping. Can someone help me understand why this is the case?

RobG
  • 142,382
  • 31
  • 172
  • 209
mb_s88
  • 392
  • 1
  • 12

0 Answers0