Slice and Splice, Splice Looping in Wrong Direction

Tell us what’s happening:
Hey guys,

Very close to being done here, but can’t seem to figure out why my Splice method is adding the elements from arr1 in the wrong order. Any tips on how to get this to flip?

Your code so far

function frankenSplice(arr1, arr2, n) {
var oldArr = arr1.slice([...arr1]);
for (let i = 0; i < arr1.length; i++) {
  arr2.splice(n, 0, oldArr[i])
return arr2;

console.log(frankenSplice([1, 2, 3], [4, 5], 1));

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36.

Challenge: Slice and Splice

Link to the challenge:

Consider that n doesn’t change after one loop pass and during the next loop pass it’s still adding at the same index. Regardless of the fact that array was modified.

1 Like

Ah, great advice. Was able to figure it out from here. Thank you!