So, I am dropping the question here and my code below it.
The sort method for arrays can take an argument that is a comparison function with two paramete
sort