Skip to content

Instantly share code, notes, and snippets.

@jonasraoni
Created March 15, 2021 12:13
Show Gist options
  • Save jonasraoni/eafa9caf3107c0c4a8d029f6add6302c to your computer and use it in GitHub Desktop.
Save jonasraoni/eafa9caf3107c0c4a8d029f6add6302c to your computer and use it in GitHub Desktop.
Compare texts using another locale in JavaScript
const comparer = new Intl.Collator('ru', { numeric: true }).compare;
console.log(comparer('ф', 'в')); //returns -1, 0, 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment