JavaScript Sort Array по индексу
//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
//For Ascending
a.sort((a,b)=> (a.name > b.name ? 1 : -1))
//For Descending
a.sort((a,b)=> (a.name < b.name ? 1 : -1))