1//sorts arrays of numbers
2function myFunction() {
3 points.sort(function(a, b){return a-b});
4 document.getElementById("demo").innerHTML = points;
5}
1var sortedArray = myArray.sort(function(a,b){
2 if (a.name < b.name)
3 return -1;
4 else if (a.name == b.name)
5 return 0;
6 else
7 return 1;
8 });