They don’t talk about … (spread).
furthermore they give as example only arrays with strings inside.
But that’s works now.
This my solution:
function frankenSplice(arr1, arr2, n) {
let copyArr2 = arr2.slice(0);
copyArr2.splice(n, 0, ...arr1);
return copyArr2;
}
frankenSplice([1, 2, 3], [4, 5, 6], 1);
I made the same mistake like in this other topic.
https://forum.freecodecamp.org/t/title-case-a-sentence-cascading-methodes/476760/3
I’m still really not well understand with that.
If I write this code, that not works but why ?
function frankenSplice(arr1, arr2, n) {
let copyArr2 = arr2.slice(0);
let result = copyArr2.splice(n, 0, ...arr1);
return result;
}
frankenSplice([1, 2, 3], [4, 5, 6], 1);