Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

order array of objects by id javascript

items.sort(function(a, b) { 
  return a.id - b.id  ||  a.name.localeCompare(b.name);
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #order #array #objects #id #javascript
ADD COMMENT
Topic
Name
1+1 =