代码示例:(标识:jsck_sort_high_2)
<!DOCTYPE html>
<html>
<body>

<h1>JavaScript 数组</h1>

<p>sort() 方法对数组的项目进行排序。</p>

<p id="demo"></p>

<script>
const points = [40, 100, 1, 5, 25, 10];

// Sort the numbers in ascending order:
points.sort(function(a, b){return a-b});

// points[0] is now the highest value:
document.getElementById("demo").innerHTML = points[points.length-1];
</script>

</body>
</html>
运行结果: