Intl.Collator Playground

The cooperative’s member cards filed twice: sort() by UTF-16 code units, Intl.Collator by language, numbers and accents. Where do capitals, RT numbers and…

Why it matters

A list people read (contacts, products, file names) looks broken when sorted by code unit: capitals sneak to the top, numbers scramble, accents land at the end. A collator gives the order readers expect, in their language.

The key idea

The default sort() compares code units, not the alphabet

Common mistakes

Try it in this playground