Tell us what’s happening:
The following code is not passing the test for this algorithm exercise, but the output i’m seeing matches the expected output. Can someone help me understand what I’m doing wrong?
Your code so far
function frankenSplice(arr1, arr2, n) {
// It's alive. It's alive!
let x = arr1.slice(0,arr1.length);
let newArr = [...arr2];
newArr.splice(n,0,x);
console.log(newArr);
return newArr;
}
frankenSplice([1, 2], ["a", "b"], 1);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice