Sorting Strings

Learn how to sort strings using the localeCompare method.

We'll cover the following...

Often in software development, we have to sort strings. There are a few problems with string sorting:

  • Uppercase and lowercase letters are sorted differently: 'a' > 'B',
  • accented characters are completely out of sequence: 'á' > 'b'
...