1function bubbleSort(array) {
2 var done = false;
3 while (!done) {
4 done = true;
5 for (var i = 1; i < array.length; i += 1) {
6 if (array[i - 1] > array[i]) {
7 done = false;
8 var tmp = array[i - 1];
9 array[i - 1] = array[i];
10 array[i] = tmp;
11 }
12 }
13 }
14
15 return array;
16}
17
18var numbers = [12, 10, 15, 11, 14, 13, 16];
19bubbleSort(numbers);
20console.log(numbers);
1//sorts arrays of numbers
2function myFunction() {
3 points.sort(function(a, b){return a-b});
4 document.getElementById("demo").innerHTML = points;
5}