In the below example we have an array of review objects which have a "rating" and "votes" property. We want to sort first by ratings and then by votes (where two review objects have the same rating we want to give preference to the one with …