Showing problem but why

Error is: All elements from the first array should be added to the second array in their original order.

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

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

plz post the link of this challenge.

Can you explain what the logic of this part is? What are you expecting it to do?

The message is a little bit unhelpful considering you don’t really know what it is testing for.

Here is the case that fails with your code.

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

Here is the actual test code:

text: All elements from the first array should be added to the second array in their original order.
testString: assert.deepEqual(frankenSplice([1, 2, 3, 4], [], 0), [1, 2, 3, 4]);

Challenge link:

Please check with this you may get the answer.

In that question we also suppose to use n to place the arr1 in between arr2’s index number and continue it.

function frankenSplice(arr1, arr2, n) {
return […arr2.slice(0, n), …arr1, …arr2.slice(n, arr2.length)];
}

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

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

You can post solutions that invite discussion (like asking how the solution works, or asking about certain parts of the solution). But please don’t just post your solution for the sake of sharing it.
If you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler] and [/spoiler] tags on the line above and below your solution code.

Just in case it wasn’t clear.

Your code is passing all the tests except the one where arr2 is empty. You can just check the length of arr2 and if it’s empty return arr1.