Answer "Doesn't Work" - Slice and Splice

Tell us what’s happening:
Not sure why FCC is telling me this answer doesn’t work. It seems to be doing what I understand the prompt is asking me for.

Your code so far


function frankenSplice(arr1, arr2, n) {
  var finalArr = arr2.slice(0);
  console.log(finalArr); //Test that the mutate-able arr2 was copied succesfully.
  finalArr.splice(n, 0, arr1);
  console.log(finalArr); //Test that our answer will work before we hit submit.
  return finalArr;
}

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36.

Link to the challenge:
htt ps ://lea rn.freecodecamp. org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice

The FCC-implemented solution is a similar solution to mine, but they use an entire “for loop” that seems extraneous given the prompt. I’m hoping they don’t just want me to implement it that way for no reason.

Upon further evaluation, I’m assuming that implementing the solution my way actually means that the entire arr1 is implemented as 1 array, rather than each individual item. This isn’t shown by using console.log(), however I guess it makes sense. I’m not sure how best to debug array-based problems in the future given this new information

If you use the browser console to debug you can see if something is an array or not

Thank you not sure how to do that but next time it comes up I’ll try and figure it out.