title: Replacing array element with specific elements from another array
body: <p>So I am trying to implement the merge sort using javascript and the problem I've ran into is that I can't replace my original array of numbers with values from the sorted sub-array(s). </p>
  
  <p>I've seen the following solution in a similar question: </p>
  
  <pre><code>var arr = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'];
  var anotherArr = [ 1, 2, 3 ];
  
  Array.prototype.splice.apply(arr, [0, anotherArr.length].concat(anotherArr));
  
  console.log(arr);
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>[ 1, 2, 3, 'd', 'e', 'f', 'g', 'h', 'i', 'j']
  </code></pre>
  
  <p>However, here <strong>ALL</strong> the elements of <code>anotherArr</code> are being put into <code>arr</code>.</p>
  
  <p>Is there a way for me to specify <strong>only</strong> the elements I want to insert into <code>arr</code> instead?</p>