Tell us what’s happening:
So I got the solution but was struggling for a long time as I had ‘n + 1’ in the last line of the for loop instead of ‘n++’. Why does ‘n + 1’ not work here?
**Your code so far**
function frankenSplice(arr1, arr2, n) {
let a = arr2.slice(0, arr2.length);
let b = arr1.slice(0, arr1.length);
for (let i = 0; i < b.length; i++) {
a.splice(n, 0, b[i]);
n++;
}
return a;
}
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/89.0.4389.128 Safari/537.36
.
Challenge: Slice and Splice
Link to the challenge: