Sort an array according to the order defined by 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);
});