1// Alphabetically
2const ascending = data.sort((a, b) => a[field].localeCompare(b[field]))
3// Descending
4const descending = ascending.reverse()
5
1var items = ['réservé', 'premier', 'communiqué', 'café', 'adieu', 'éclair'];
2items.sort((a, b) =>
3 a.localeCompare(b)//using String.prototype.localCompare()
4);
1//sort array alphabetically
2objArray.sort(function(a, b) {
3 return a.localeCompare(b);
4});