title: Javascript Push/Shift same element multiple times
body: <p>I have the following code:</p>
  
  <pre><code>var foo = 'foo'
  var bar = 'bar'
  var arr = [1,2,3]
  </code></pre>
  
  <p>I want to add to <code>foo</code> several times at the beginning of the array and <code>bar</code> at the end of the array. The number of times each element added should be dynamic and the resulting array should be something like:</p>
  
  <p><code>['foo','foo',1,2,3,'bar',bar','bar']</code></p>
  
  <p>Is there a better method than using a loop for each element?I could use lodash if needed. </p>