frankenSplice() without For loop

Tell us what’s happening:
Hi, with my code, I am able to achieve the requirement. Example, frankenSplice([“claw”, “tentacle”], [“head”, “shoulders”, “knees”, “toes”], 2) gives me [“head”, “shoulders”,“claw”, “tentacle”, “knees”, “toes”] in the console. However, it fails the pass the first 4 test cases. I saw the solution where the arr1 is looped and every item is added individually into the second array while incrementing the position ‘n’ every time. I have achieved the solution without the for loop. Could someone please explain why my code does not pass the test cases?

Your code so far


function frankenSplice(arr1, arr2, n) {
  // It's alive. It's alive!
  var arr4 = [...arr2];
  console.log(arr4);
  arr4.splice(n, 0, [...arr1]);
  console.log(arr4);
  return arr4;
  
}

frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2)

Your browser information:

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

The issue is that you have a multidimensional array, when the expected result is a flat monodimensional array

arr4 is:

[ 'head',
  'shoulders',
  [ 'claw', 'tentacle' ],
  'knees',
  'toes'
]

In this cases FCC console is not much useful. You can use this for the FCC console:

console.log(JSON.stringify( /* what you want to print here */ ))

Or you can also use directly the browser console or a different tool, for example repl.it, or JavaScript Tutor

@ilenia, got that now. Thank you very much for the simple explanation.