Tell us what’s happening:
Hi guys! So as you can see, I thought that perhaps I could use the spread operator as the last argument in splice, but it doesn’t appear to have worked. I think the slice stage seems to be working from a console.log I did but I can’t seem to figure out why splice isn’t working. Console.logging the splice instead of returning it just shows that I’ve created an empty array
Any pointers would be much appreciated!
Your code so far
function frankenSplice(arr1, arr2, n) {
var why = arr2.slice();
return why.splice(n, 0, ...arr1);
}
frankenSplice([1, 2, 3], [4, 5], 1);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice/