Tell us what’s happening:
I tested the results in the console and it yields the same results when I paste the basic solution to replace my code.
“All elements from the first array should be added to the second array in their original order.”
Does this mean I have to add each element one by one, as in a loop? Even if that’s the case, I don’t see why my test cases are returning false.
"frankenSplice([1, 2, 3], [4, 5], 1)
should return [4, 1, 2, 3, 5]
"
There is still a cross against these even though when I console.log arr3 it prints the correct array.
Your code so far
function frankenSplice(arr1, arr2, n) {
// It's alive. It's alive!
let arr3 = arr2.slice();
arr3.splice(n, 0, arr1);
console.log(arr3);
return arr3;
}
frankenSplice([1, 2, 3], [4, 5, 6], 1);
frankenSplice([1, 2, 3], [4, 5], 1)
frankenSplice([1, 2], ["a", "b"], 1)
frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2)