Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Javascript sort array by index

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

//For Descending
a.sort((a,b)=> (a.name < b.name ? 1 : -1))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Javascript #sort #array #index
ADD COMMENT
Topic
Name
6+4 =