源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>享学课堂</title> </head> <body> <p>最小的数是:<span id="demo"></span></p> <script> var points = [40, 100, 1, 5, 25, 10]; points.sort(function(a, b){return a-b}); document.getElementById("demo").innerHTML = points[0]; </script> </body> </html>
运行结果