Stuck on "Slice and Splice"

Stuck on "Slice and Splice"
0

In my opinion my code works (at least in the chrome dev console) and fulfills the requirements of the challenge, but for some reason it says that it fails every requirement.

function frankenSplice(arr1, arr2, n) {
    arr3 = [...arr2];
    arr1.forEach(element => {
      arr3.splice(n, 0, element);
      n++;
    });
    return arr3;
  }

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice

arr3 is not defined bro you need to add let or const

1 Like

the thing that arr3 is not defined is sound advice

But, have you checked what your function is returning in some way?

this is a good helper for beginners for example: JavaScript Tutor