Function returns an unexpected value

Tell us what’s happening:
Describe your issue in detail here.

I don’t understand the difference between the code I commented out and the code under it. Can someone explain?

  **Your code so far**

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

// why does the code above (commented out) return "[]" and the code below returns "[ 4, 1, 2, 3, 5, 6 ]"
newArr.splice(n, 0, ...arr1);
return newArr;
}

console.log(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/91.0.4472.164 Safari/537.36

Challenge: Slice and Splice

Link to the challenge:

Well, what does splice itself return?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.