This is purely a flexibility exercise with JavaScript. I'm attempting to create an array of integers with Javascript without a loop and in this particular fashion:
var a = Array(100).map(function(x, y) { return y + 1 });
I would expect and Array of integers 1 - 100. Instead it remains undefined * 100? I can't even console.log from within the map function?
I understand from this great post Sequences using JavaScript Array that the below does accomplish the goal using Array.apply, I just understand why its needed?
var a = Array.apply(0, Array(100)).map(function(x,y) { return y + 1 }); a
Thanks for any insight :)