Tablica sortowania JavaScript według indeksu

//For Ascending
a.sort((a,b)=> (a.name > b.name ? 1 : -1))

//For Descending
a.sort((a,b)=> (a.name < b.name ? 1 : -1))
Lucky Locust