Slice and Splice not passing test for keeping items in original aorder

I got the following solution to pass all tests except “All elements from the first array should be added to the second array in their original order.” Any idea why?

function frankenSplice(arr1, arr2, n) {
  let resultArr = []
  for (let i = 0; i < arr2.length; i++){
    if (i == n) {
      resultArr.push(...arr1)
    }   
    resultArr.push(arr2[i]);  
  }
  return resultArr;
}

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

What value would your function return with the following call?

frankenSplice([1, 2, 3, 4], [], 0));

What should it return instead?

Thanks for the reply. I see the problem in my implementation, and was able to solve much more elegantly (and I imagine more efficiently) using splice. :slight_smile: