1//sort array alphabetically
2objArray.sort(function(a, b) {
3 return a.localeCompare(b);
4});
1//sorts arrays of numbers
2function myFunction() {
3 points.sort(function(a, b){return a-b});
4 document.getElementById("demo").innerHTML = points;
5}