Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sort object by value javascript

const objSortedByVal = Object.fromEntries(
  Object.entries(obj).sort(([, a], [, b]) => a - b)
)
 
PREVIOUS NEXT
Tagged: #sort #object #javascript
ADD COMMENT
Topic
Name
4+9 =