1// Alphabetically
2const ascending = data.sort((a, b) => a[field].localeCompare(b[field]))
3// Descending
4const descending = ascending.reverse()
5
1function sortString(str){
2 var arr = str.split('');
3 var sorted = arr.sort();
4 return sorted.join('');
5}Copy