To reverse the sort order just multiply the return value of the comparator function by -1.
Or add another parameter into the comparator function 1 for normal sort and -1 for reverse sort
const comparator = (a, b, c) => {
if (a < b) return -1 * c
if (a > b) return 1 * c
return 0 // stay where you are
}