Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sort alphabetically javascript

let users = [{
     firstName: "Ahmed",
     lastName: "ElNawawy",
	},
    {
     firstName: "Khaled",
     lastName: "ElNawawy",
	}
];

users.sort((a, b) => a.firstname.localeCompare(b.firstname))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sort #alphabetically #javascript
ADD COMMENT
Topic
Name
1+4 =