How to sort strings in JavaScript?
Read moreWhat is localeCompare?
The localeCompare() method returns a number indicating whether a reference string comes before, or after, or is the same as the given string in sort order .18 Şub 2022
Read moreDoes localeCompare work on numbers?
As you can see, with the . localeCompare() method (and the numeric option) powering the sort operation, the embedded numbers are now treated as numbers .
Read moreWhy use localeCompare?
localeCompare() allows for the fact that you may want to ignore certain differences in the strings (such as puncutation or diacriticals or case) and still allow them to compare the same or you want to ignore certain differences when deciding which string is before the other.
Read more