firstString comes before, after or is equivalent to the
TIL about localeCompare, used that to sort a object based on a string property. It's pretty handy and you can pass locale param and get that sorted right for that locale 😀.https://t.co/nEWVrjUa3y pic.twitter.com/YvHoYBj7Vg— Rafael Nunes (@peaonunes) June 11, 2020
It implements the compartor logic returning a negative number when the
firstString occurs before
secondString, a positive number the other way around, and
0 if they are equivalent. Beyond that, it may take
locales so the method is localized by default.