sort an array of strings using javascript code example
Example 1: sort array of objects javascript
list.sort((a, b) => (a.color > b.color) ? 1 : -1)
Example 2: javascript sort array strings alphabetically
//sort array alphabetically
objArray.sort(function(a, b) {
return a.localeCompare(b);
});