sort an array in alphabetical order code example
Example 1: array sort by alphabetical javascript
users.sort((a, b) => a.firstname.localeCompare(b.firstname))
Example 2: put array in alphabetical order
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.sort();