I checked my code on the browser console to see if I am creating a multidimensional array by mistake, but it seems like I am not. However, I could not understand why fcc console does not accept my answer. Can anyone help me to understand. Here is the code:
function frankenSplice(arr1, arr2, n) {
let arr3 = arr2.slice(0, n);
arr3.push(...arr1);
arr3.push(...arr2.slice(n));
return arr3;
}
frankenSplice([1, 2, 3], [4, 5], 1)
Edit: The error that I’m getting is as follows:
frankenSplice([1, 2, 3], [4, 5], 1) should return [4, 1, 2, 3, 5].
frankenSplice([1, 2], ["a", "b"], 1) should return ["a", 1, 2, "b"].
frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2) should return ["head", "shoulders", "claw", "tentacle", "knees", "toes"].
All elements from the first array should be added to the second array in their original order.