确定数组中最小的数

  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <h1>JavaScript 数组排序</h1>
  6.  
  7. <p>最低值是:<span id="demo"></span></p>
  8.  
  9. <script>
  10. var points = [40, 100, 1, 5, 25, 10];
  11. points.sort(function(a, b){return a-b});
  12. document.getElementById("demo").innerHTML = points[0];
  13. </script>
  14.  
  15. </body>
  16. </html>