JavaScript通过Math.Min返回两个数中较小的那个
<!DOCTYPE html> <html> <body> <p id="demo">Click the button to return the lowest number of 5 and 10.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { document.getElementById("demo").innerHTML=Math.min(5,10); } </script> </body> </html>
运行上面代码得到数字为5