Could this just be `b.localeCompare(a)` so you don't need the `reverse` call at all on the next line?