Why isn't splicing working

Hello,
please help, I can’t figure out why my splicing is not working

You have passed an array as the 3rd argument to splice. Instead, you should be passing each value you want to add as an argument to it.

Also, in the future, please post actual code instead of a screen shot of code. This makes it easier for someone to test out your code without having to type it. Thanks.

2 Likes

Thank you for your answer.

function frankenSplice(arr1, arr2, n) {
  let localArr = arr2.slice();
  localArr.splice(n, 0, ...arr1);
  return localArr;
}

Why is this code working? Wasn’t an array also passed here as the third argument?

I suggest reviewing the following challenge for more about the spread operator.

1 Like