Slice and Splice: don't understand why the brackets should be printed

Tell us what’s happening:

I have an output but:

It doesn’t work with other inputs because the loop index (i) needed is different.
With this line alone array2Copy.splice(n, 0, arr1); I have the input needed for each input. BUT it doesn’t work. It seems that it is required the brackets to be printed.
suggestions welcome…

Your code so far


function frankenSplice(arr1, arr2, n) {
  arr1.slice(0);
  let array2Copy = arr2.slice(0);
  
  for (let i = 2; i < arr1.length; i++){
    array2Copy.splice(n, 0, arr1);
  }
    

  console.log(typeof(array2Copy));
  console.log(array2Copy)

  return array2Copy;//4, 1, 2, 3, 5
}

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



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 OPR/63.0.3368.94.

Link to the challenge:

you are placing “array” instead of “items of array” at this line. try placing items of array using … ?

array2Copy.splice(n, 0, ...arr1)

to concat arrays use spread operator

link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax

Great suggestion. I went up one step: So I don’t have the problem index anymore, because I pointed out that the loop should take each element of arra1 into arr2Copy. Now: I don’t understand whether should I turn each array element into a character but stored it in an array, should I?
If so, I tried this with map, trying to map each element to toString. So, what am I doing wrong? If I judge based on what is the screenshots (running on node) It seems that I shouldn’t take anything into string.

function frankenSplice(arr1, arr2, n) {
  arr1.slice(0);
  let array2Copy = arr2.slice(0);
  
  for (let i = 0; i < arr1.length; i++){
    array2Copy.splice(n, 0, arr1[i]);
  }
let result = array2Copy.map(i => i.toString());   

  return array2Copy;
}

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