Answers for "sorttable alphabetically javascript"

10

js sort alphabetically

users.sort((a, b) => a.firstname.localeCompare(b.firstname))
Posted by: Guest on October-19-2020
3

js sort alphabetically

users.sort(function(a, b){
    if(a.firstname < b.firstname) { return -1; }
    if(a.firstname > b.firstname) { return 1; }
    return 0;
})
Posted by: Guest on July-13-2021

Code answers related to "sorttable alphabetically javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language