I'm generally curious why the first example doesn't populate array with default values?
// first example
var arr = new Array(5);
var r = arr.map(function () { return 0; });
console.log(r); // []
// second example
var arr2 = Array.apply(null, Array(5));
var r2 = arr2.map(function () { return 0; });
console.log(r2); // [0, 0, 0, 0, 0]
mapcan't work on those. The second is an array ofundefinedelements which it can process.