Sort one array according to 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);
});