Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript sort associative array

function getSortedKeys(obj) {
    var keys = Object.keys(obj);
    return keys.sort(function(a,b){return obj[b]-obj[a]});
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #sort #associative #array
ADD COMMENT
Topic
Name
8+8 =