title: Most efficient way to prepend a value to an array
body: <p>Assuming I have an array that has a size of <code>N</code> (where <code>N &gt; 0</code>), is there a more efficient way of prepending to the array that would not require O(N + 1) steps?</p>
  
  <p>In code, essentially, what I currently am doing is</p>
  
  <pre><code>function prependArray(value, oldArray) {
    var newArray = new Array(value);
  
    for(var i = 0; i &lt; oldArray.length; ++i) {
      newArray.push(oldArray[i]);
    }
  
    return newArray;
  }
  </code></pre>