Basic Algorithm Scripting challenge for Slice and Splice

I’ve looked through past topics with issues for this challenge and none seem to be quite the same problem as I’m having. In the console my code always does what the challenge specifies, which is:

Use the array methods slice and splice to copy each element of the first array into the second array, in order.

Begin inserting elements at index n of the second array.

Return the resulting array.

I’m kind of stumped. Below is my code:

function frankenSplice(arr1, arr2, n) {
  let x = arr2
  x.splice(n, 0, arr1)
  return x;

frankenSplice([1, 2, 3], [4, 5], 1));

Any help as to what I’m missing to understand this would be appreciated. I’ve heard others suggest that the checker is broken but my hunch is that this is not the case.

Thanks in advance!

A key issue here is that it’s asking you to put the values from the first array into the second, but you are only putting a single value (the actual array). So you get like [1,2,[3,4]] instead of [1,2,3,4]

1 Like

Interesting. I thought of this but in the console it comes out as [1,2, 3, 4]. I suppose this explains the need for the for loop then :). Thanks for the help!