W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!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 descending order: points.sort(function(a, b){return b-a}); // points[0] is now the highest value: document.getElementById("demo").innerHTML = points[0]; </script> </body> </html>