I have an array ["a", "b", "c", "d", "e", "f"]
and also an subarray
["a", "b", "c"]
. Now the next element in the main array to subarray
is d
. So I want to get the array as ["a", "b", "c", "d"]
.
I know there are so many ways to get this . Like
get length of subarray => 3
slice from main array `length of subarray + 1` => _.slice(main_array, 0, 4)
Is there any other elegant way to do this , I am preferably looking for solution using lodash
.