Challenge: Inserting Slice in a Slice

This lesson brings you a challenge to solve.

Problem statement #

Make a function that inserts a string slice into another string slice at a certain index.

Input #

Two Slices and an integer for index

Sample input #

["M", "N", "O", "P", "Q", "R"] // slice in which another slice will be added
["A" "B" "C"] // slice to be appended
0             // index 

Output #

Slice

Sample output #

["A" "B" "C" "M" "N" "O" "P" "Q" "R"]

Try to implement the function below. Feel free to view the solution, after giving some shots. Good Luck!

Get hands-on with 1200+ tech skills courses.