sort alphabetically array in javascript code example
Example 1: javascript sort array strings alphabetically
//sort array alphabetically
objArray.sort(function(a, b) {
return a.localeCompare(b);
});
Example 2: put array in alphabetical order
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.sort();