Good news is that the sort function does take a callback function with two arguments representing the two items being compared. In an array of numbers, if the difference between the two arguments is a positive number, that means that the first is bigger than the second. If the difference is a negative number, the second is bigger than the first.
This approach can also be harnessed for more unique examples. Below, for example, I have an array of human needs that I want to sort, and in the callback I provide a correct order template that is then used for the sorting: