Skip to content

Commit 3737326

Browse files
committed
Update to book 4, chapter 7, example 13
1 parent a92d4c8 commit 3737326

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

bk04ch07/example13.html

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
</div>
1919

2020
<script>
21-
// This function sorts numbers from lowest to highest
21+
// This function sorts numbers from highest to lowest
2222
function numericSort(a, b) {
23-
return (a - b);
23+
return b - a;
2424
}
2525

2626
const myArray = [3, 5, 1, 6, 2, 4];
@@ -30,8 +30,7 @@
3030

3131
// Sort the array
3232
myArray.sort(numericSort);
33-
34-
// Write the array after sorting it
33+
3534
str+= "myArray (after sorting): " + myArray;
3635

3736
document.getElementById('output').innerHTML = str;

0 commit comments

Comments
 (0)