title: How to insert an item into an empty array at a specific index?
body: <p>I want to insert a item to specified index of an empty Array. I saw there is   Array.prototype.splice method. However, if I use splice on empty Array, it just add item to end off Array as shown below.</p>
  
  <pre><code>var a = [];
  a.splice(3,0,"item-3");
  console.log(a); //returns ['item-3']
  </code></pre>
  
  <p>What I want to accomplish is to have array as given below. </p>
  
  <pre><code>console.log(a); //returns [,,,'item-3']
  or
  console.log(a); //returns [undefined,undefined,undefined,'item-3']
  </code></pre>
  
  <p>Thanks for your help.</p>
  
  <p>Edit: I saw the question on <a href="https://stackoverflow.com/questions/586182/how-to-insert-an-item-into-an-array-at-a-specific-index">How to insert an item into an array at a specific index?</a> but, it did not explain how to insert to specified index of empty array.</p>