sort array on the basis of order in another array code example
Example: sort array based on another array
arr.sort((a, b) =>{
return sortingArray.indexOf(a) - sortingArray.indexOf(b);
});
arr.sort((a, b) =>{
return sortingArray.indexOf(a) - sortingArray.indexOf(b);
});