What is the best way to divide an array at the occurrence of the word 'split' and generate smaller sub arrays?
This is a sample representation of my current array:
const myArray = ['abc', 'xyz', 123, 'split', 'efg', 'hij', 456, 'split'];
This is how I envision the transformed array:
const newArray =[['abc', 'xyz', 123], ['efg', 'hij', 456]];
In addition, I have stored the indexes of the word 'split' in an array like this:
const splitIndex = [3, 7];