title: replacing empty with zero values in array
body: <p>i have an array as , i need to remove the empty values and replace it with zeros.</p>
  
  <p>i have achieved this much . when i checked the array length is 8 but it shows 2 elements only. What is the best method to replace it with zeros.</p>
  
  <pre><code>var a = [];
  
  a[3] = 5
  
  a[5] = 15
  
  console.log(a.length) // 6
  
  console.log(a) // [empty,empty,empty,5,empty,15] 
  
  how can i make the output as [0,0,0,5,0,15]
  </code></pre>
  
  <p>// tried this way didn't worked </p>
  
  <pre><code>a.map(o =&gt; o !== null ? o : 0)
  </code></pre>