Slice and Splice

You are given two arrays and an index.

Copy each element of the first array into the second array, in order.

Begin inserting elements at index n of the second array.

Return the resulting array. The input arrays should remain the same after the function runs.

Tests

  • Waiting: 1. frankenSplice([1, 2, 3], [4, 5], 1) should return [4, 1, 2, 3, 5].
  • Waiting: 2. frankenSplice([1, 2], ["a", "b"], 1) should return ["a", 1, 2, "b"].
  • Waiting: 3. frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2) should return ["head", "shoulders", "claw", "tentacle", "knees", "toes"].
  • Waiting: 4. All elements from the first array should be added to the second array in their original order. frankenSplice([1, 2, 3, 4], [], 0) should return [1, 2, 3, 4].
  • Waiting: 5. The first array should remain the same after the function runs.
  • Waiting: 6. The second array should remain the same after the function runs.
/**
* Your test output will go here
*/