title: Fast way to push and shift arrays in ES6
body: <p>I have a data stream which continuously needs to update an array. The array itself is always bigger than the stream which is coming in. This would mean that I have to concat the buffer to the array and shift everything. However, concatenation is slow so I was wondering if there is a fast way of doing this?</p>
  
  <p>Example:</p>
  
  <pre><code>var array = [1,2,3,4,5,6];
  var stream = [7,8,9];
  array = magicalFunction(array,stream); // outputs [4,5,6,7,8,9]
  </code></pre>
  
  <p>The array function is used for plotting with ChartJS. It's a rolling plot so as data comes in (it comes in chunks) I have to update the chart by shifting the entire data set.</p>