Tell us what’s happening:
I’m trying to push the contents from arr2 into a new array. But I just can’t get the second array to stay the same.
Your code so far
function frankenSplice(arr1, arr2, n) {
var newArr = [];
for(let i = 0; i < arr1.length; i++) {
arr2.splice(n+i, 0, arr1[i]);
newArr = arr2;
}
return newArr;
}
frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice