Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sort object by key value js

//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: #sort #object #key #js
ADD COMMENT
Topic
Name
6+4 =