I have an array of strings and I'd like to split that into two. An array containing the elements before the separator, and another one after it.
let sourceArray = ["items that", "are", "split", "by a string"]
// String that splits this array: "split"
// Expected output: [["items that", "are"], ["by a string"]]
I tried joining the array into a string and using .components(), but that removes the actual elements of the original array. Is there a way to do this using a built-in method or do I need to loop over it?