Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js sort alphabetically

users.sort(function(a, b){
    if(a.firstname < b.firstname) { return -1; }
    if(a.firstname > b.firstname) { return 1; }
    return 0;
})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #sort #alphabetically
ADD COMMENT
Topic
Name
2+5 =