DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
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
COMMENT
Name
6+2 =
Submit