Slice and splice Javascript, Order Error

function frankenSplice(arr1, arr2, n) {
let a = arr2.slice(0);
let start = a[n];
a.splice(n,1, …arr1.slice(0), start);
return a;
}

console.log(frankenSplice([1, 2, 3], [4, 5], 1));

Whenever I run this i get the error:
All elements from the first array should be added to the second array in their original order.

Output value is same as desired but cant figure out the wrong with order.

You are using splice to delete one value from the “a” array at position n. Try using splice to insert only…