Slice and Splice ( What is wrong? )

Tell us what’s happening:

Can someone tell me why I’m not passing this? I use slice and splice, and the output in the console is exactly what the question is asking for. :neutral_face:

Your code so far


function frankenSplice(arr1, arr2, n) {
  const clone = arr2.slice();
  clone.splice(n, null, arr1)
  return clone;
}

frankenSplice([1, 2, 3], [4, 5], 1);
frankenSplice([1, 2], ["a", "b"], 1)
frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2)

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36.

Link to the challenge:

Not quite:
For frankenSplice([1, 2, 3], [4, 5, 6], 1), the output in the console is 4,1,2,3,5,6, but it’s looking for 4,1,2,3,5.

Press 12 and you should be able to see that it is actually printing [4, [Array(3)], 5] to the console. arr1 hasn’t been spread out, if you catch my hint :wink:

Ahhhhh!! Great catch! Caught the hint, and that did the trick. Thanks @alexanderkopke

That’s actually a typo on FCC’s part @Steffan153 . Look at the difference between the call to the function ‘frankenSplice’ in the test area, as opposed to what’s in the terminal area. You’ll see one has the second array with 3 indices, and the other only has 2.