freeCodeCamp Challenge Guide: Slice and Splice

Hi guys, it took me quite a while however I just cannot understand why the below solution would not work…

function frankenSplice(arr1, arr2, n) {
  let arr2Copy = arr2.slice(0);
  let arr2Updated = arr2Copy.splice(n, 0, ...arr1);
  return arr2Updated;
}

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

Thanks

Look at what splice returns.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.