Recipe 11.11

Sorting an Array of Names

Code

JavaScript
const names = [
  'Elena',
  'Mário',
  'André',
  'Renée',
  'Léo',
  'Olga',
  'Héctor',
]

const collator = new Intl.Collator();
names.sort(collator.compare);
Web API Cookbook
Joe Attardi