Tip This example reverses an array, not a string, because we converted the string to an array before reversing it.
letters = "cat"
# Get letters from string with split.# ... Then sort, and reverse, the letters.# ... Finally join them back together into a string.
result = letters.split("").sort.reverse.join()
A summary. In sorting, we can sometimes apply a descending (high-to-low) sort instead of invoking reverse(). But if we are not sorting, reverse() can be directly called.