Basic Algorithm Scripting: Slice and Splice, need help with Splice

Tell us what’s happening:

Hi everyone, I am unsure why my code doesn’t work. According to the splice() example here, it should right?

Your code so far


function frankenSplice(arr1, arr2, n) {
return arr2.splice(n,0,arr1);
}

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/81.0.4044.129 Safari/537.36 OPR/68.0.3618.63.

Challenge: Slice and Splice

Link to the challenge:

The third arg may be flatten.

function frankenSplice(arr1, arr2, n) {
  return arr2.splice(n,0,...arr1);
}

splice() is changing array in-place, it doesn’t return modified array. It may return elements that are removed from array, but that’s a different case.

if read the link you have posted it says

Return value
An array containing the deleted elements.

do you want to return the deleted elements?