Slice and Splice - Error in tests?

Tell us what’s happening:
My code is satisfying all tests but returning false on the below which i believe is an error:
All elements from the first array should be added to the second array in their original order.

Your code so far


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

frankenSplice([1, 2], ["a", "b"], 1);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36.

Challenge: Slice and Splice

Link to the challenge:

Hi, i think it has to do with the way the test is implemented. This passes for me,

function frankenSplice(arr1, arr2, n) {
const arr = [...arr2]
arr.splice(n, 0 , ...arr1)

return arr;
}

Probably you need to use splice somewhere.

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

I see! I solved it after this using splice also, I guess the question should be more clear on this fact.

in one of the tests, n is undefined, so you can’t do this

if you think yours is a valid solution, please report a bug so the tests can be fixed

you can use **slice **to copy all elementes from arr1 and add in arr2 with push element, you can equal this information ( obtainted by slice) new variable and add in arr2 with push element