# Why does 'n + 1' not work here

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

1 Like

if you write `n+1` you are not changing the value of `n`, to change the value of `n` you would need to write `n=n+1`

1 Like

wow that was stupid of me to ask. thank you anyway!

There are no stupid questions.

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