The error in basic algorithm "slice and splice"

The error in basic algorithm "slice and splice"
0

#1

Tell us what’s happening:
the code can result what it want in basic algorithm scripting within other editor.But it result error in fcc. I can’t find the reason. Help me.

Your code so far


function frankenSplice(arr1, arr2, n) {
  // It's alive. It's alive!
  let arr = arr2.slice(0);
  arr.splice(n, 0, arr1);
  return arr;
}

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

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice


#2

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

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


#3

your code output is - [4, [1, 2, 3], 5, 6] you need to get this output [4,1,2,3,5,6] to pass the tests
...arr1


#4

:joy:careless…thanks a lot


#5

careless…thanks a lot