Slice and Splice - index n problem

Tell us what’s happening:

Hi
Please: what am I doing wrong here? The contents of arr1 are being added to the end of arr2, and not at index n, not sure why.

Your code so far


function frankenSplice(arr1, arr2, n) {
  let arr2Copy = []
  arr2Copy.push(arr2)
  arr2Copy.splice(n, 0, arr1.slice())
  return arr2Copy;
}

frankenSplice([1, 2, 3], [4, 5, 6], 1);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice

Thanks for this info Randell, that makes total sense and I now understand :slight_smile:
thanks again for coming to my rescue!