Slice and Splice errors? Help please!

My code is the following:

function frankenSplice(arr1, arr2, n) {
// It’s alive. It’s alive!

var arr1Copy = arr1.slice();
var arr2Copy = arr2.slice();

for (var i = 0; i < arr1.length; i++) {

arr2Copy.splice(n, 0, arr1Copy[i]);
n++;
}

return arr2Copy;

}

frankenSplice([1, 2], [“a”, “b”], 1);

And I keep getting the following errors:

frankenSplice([1, 2], [“a”, “b”], 1) should return [“a”, 1, 2, “b”].
The first array should remain the same after the function runs.
The second array should remain the same after the function runs.

Can someone please explain to my why? I’m so lost…

Ahh that would explain it. Thank you so much! It’s a new challenge they just added right? I don’t recall seeing it in the list of challenges a few days ago.

Like @p1xt said, this challenge was not supposed to be released, and is still under development. We will remove it next time we deploy (hopefully in the next hour or so). You can skip it. Thanks for your patience.

1 Like