JavaScript max() 方法【每日一段代码97】

<html>
<body>
<script type="text/javascript">
document.write(Math.max(1,0)+"<br/ >");
document.write(Math.max(0.8,0.3)+"<br/ >");
document.write(Math.max(-0.3,-0.8)+"<br/ >");
document.write(Math.max(100,2343)+"<br/ >");
document.write(Math.max(10,20,30,55));
</script>
</body>
</html>

 

【max() 方法可返回两个指定的数中带有较大的值的那个数。返回值:参数中最大的值。如果没有参数,则返回 -Infinity。如果有某个参数为 NaN,或是不能转换成数字的非数字值,则返回 NaN。】

posted on 2012-04-25 21:29  Cosimo  阅读(163)  评论(0编辑  收藏  举报

导航