Isn't this an easier solution to Slice and Splice?

function frankenSplice(arr1, arr2, n) {
let array2 = [...arr2];
array2.splice(n, 0, ...arr1);
return array2;
frankenSplice([1, 2, 3], [4, 5, 6], 1);

Challenge: Slice and Splice

Link to the challenge:

This is the same as the second solution in the hints. Are you asking if this is “easier” than the first solution in the hints? Yes, I think the second solution is superior primarily because you don’t need to manage a couple of counting variables. But I have a feeling the first solution may have been added before JS had spread syntax.

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