So i ran my code and it failed, so then i inserted console.log statements to see the result of my slicing and splicing and it returns the correct array but when i run the test it fails. Then i looked at the solution and inserted the same console.log statements to see what their output was and we have the exact same output. Please take a look, here’s my code, i left the console.log statements in it:
function frankenSplice(arr1, arr2, n) {
// It's alive. It's alive!
let arr3 = arr2.slice();
console.log(arr3);
arr3.splice(n,0,arr1);
console.log(arr3);
return arr3;
}
frankenSplice(["a","b"], [4, 5, 6, 7, 8, 9], 4);
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice