W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <p>单击按钮可比较数字并返回最高值。</p> <button onclick="myFunction()">试一试</button> <p id="demo"></p> <script> function myFunction() { var a = Math.max(5, 10); var b = Math.max(0, 150, 30, 20, 38); var c = Math.max(-5, 10); var d = Math.max(-5, -10); var e = Math.max(1.5, 2.5); var x = a + "<br>" + b + "<br>" + c + "<br>" + d + "<br>" + e; document.getElementById("demo").innerHTML = x; } </script> </body> </html>