-
-
Save icesernia/e51610ce125b960bdf1d1369a072250d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function letterSort(lang, letters) { | |
letters.sort(new Intl.Collator(lang).compare); | |
return letters; | |
} | |
console.log(letterSort('th', ['a','ฮ', 'z', 'ก'])); // expected output: ["ก", "ฮ", "a", "z"] | |
console.log(letterSort('en', ['a','ฮ', 'z', 'ก'])); // expected output: ["a", "z", "ก", "ฮ"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment