title: What is Array.apply actually doing
body: <p>After reading <a href="https://stackoverflow.com/questions/22949976/why-does-array-applynull-args-act-inconsistently-when-dealing-with-sparse-a">this SO Question</a>, I'm still a little confused as to what Array.apply is actually doing. Consider the following snippet:</p>
  
  <pre><code>new Array(5).map(function(){
    return new Array(5);
  });
  </code></pre>
  
  <p>I expect this to init an array with 5 undefined entries, then map over them creating a two dimensional array of 5x5);</p>
  
  <p>Instead I just get the array as if it was never mapped over: </p>
  
  <pre><code>[undefined, undefined, undefined, undefined, undefined]
  </code></pre>
  
  <p>When I wrap the constructor call to array in an Array.apply call, then map over that, it works as expected:</p>
  
  <pre><code>Array.apply(null, new Array(5)).map(function(){
    return new Array(5);
  });
  </code></pre>
  
  <p>resulting in;</p>
  
  <pre><code>[[undefined, undefined, undefined, undefined, undefined],
   [undefined, undefined, undefined, undefined, undefined],
   [undefined, undefined, undefined, undefined, undefined],
   [undefined, undefined, undefined, undefined, undefined],
   [undefined, undefined, undefined, undefined, undefined]];
  </code></pre>
  
  <p>What's the deal? Is Array.apply just another way of calling new Array(), or Array.prototype.constructor? Are there any other situations where this would be advantageous? Also, why didn't my first approach pick up on the map I was sending it through?</p>
  
  <p>Thanks!
  -Neil</p>