Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sort object array javascript

//using es6, simply:
data.sort((a, b) => a.city.localeCompare(b.city) || b.price - a.price);
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #sort #object #array #javascript
ADD COMMENT
Topic
Name
1+9 =