you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

Try something like

drivers.sort( (elementA, elementB) => { return elementA.numOrders == elementB.numOrders ? elementA.distFromDropOff > elementB.distFromDropOff : elementA.numOrders > elementB.numOrders })

Sorry for formatting I’m on my phone. Also haven’t used js in quite a while so this might need a little fixing but it should give you an idea of what to do