I have following three arrays, which defines the order of some texts
arr1 = ['ab', 'bc', 'ca', 'ac']
arr2 = ['lm', 'mn', 'ml']
arr3 = ['ij', 'kj', 'pr']
I want to sort array below based on the array above. Each string of myArray is consists of 5 characters where each 2 character are from the characters of the above 3 arrays. That is, arr1 has the highest priority, arr2 has priority over arr3 but less priority than arr1. arr3 has the lowest priority.
First 2 character of each string in myArray always match at least one string in arr1, middle two character match arr2 and last two character match arr3.
myArray = ['acmnkj', 'bcmlij', 'camnij', 'bcmnij',]
How can I sort myArray so that the results are sorted by arr1, arr2 and arr3. Expected sorted array ['bcmnij', 'bcmlij', 'camnij', 'acmnkj']
How can do this?