title: Initialize Array with default value
body: <p>I was looking at <a href="https://stackoverflow.com/a/19286846">this answer</a> and I've stumbled upon the need of Array.apply to fill array:</p>
  
  <pre><code>var array = Array.apply(null, Array(5)).map(function() { return 0; });
  </code></pre>
  
  <p>I've checked and this won't actually work:</p>
  
  <pre><code>var array = Array(5).map(function() { return 0; });
  </code></pre>
  
  <p>I know i could do</p>
  
  <pre><code>var array = Array(5).fill(0);
  </code></pre>
  
  <p>to obtain same result as the first method, I'm just wondering why it needs Array.apply with null as parameter.</p>