OMG, I can’t believe I got it, I know my code can be a lot better, bit it passed all the tests.
I understood all your hints, it took me like half an hour and now I see where was my mistake.
function frankenSplice(arr1, arr2, n) {
var newArray = [];
for (var i=0; i<arr2.length/2;i++){
newArray.splice(0+i,0,arr2.slice(0,n)[i]);
}
for (i=0; i<arr1.length;i++){
var item = arr1[i];
newArray.splice(n+i,0,item);
}
for (var i=0; i<arr2.length/2;i++){
newArray.splice(newArray.length+i, 0, arr2.slice(n,arr2.length)[i]);
}
return newArray;
}
frankenSplice([1, 2, 3], [4, 5], 1);
That’s the code it passed. Thank you so much for helping me.
I’ll help others when I get better. See ya.