1
<p id="demo">单击按钮降序排列数组。</p>
2
<button onclick="myFunction()">点我</button>
3
<script>
4
function myFunction() {
5
var points = [40, 100, 1, 5, 25, 10];
6
points.sort(function(a, b) {
7
return b - a
8
});
9
var x = document.getElementById("demo");
10
x.innerHTML = points;
11
}
12
</script>