Comparing strings

The localeCompare function returns a number that indicates how a string should be ordered in relation to another string.

Loading TypeScript...

This is commonly used in an array sort function to arrange a list of strings into alphabetical order.

Loading TypeScript...

Was this page helpful?