JS Math的用法收集

  <SCRIPT language=javascript>

<!--  

function test()

{

        document.write(Math.floor(5.80) + "<br>");//取整或下舍入

        document.write(Math.round(5.80) + "<br>");//四舍五入

        document.write(Math.ceil(5.10) + "<br>");//上舍入

        document.write(Math.abs(-5.80) + "<br>");//取绝对值

        document.write(Math.max(55,58) + "<br>");//返回两个值中最大数

        document.write(Math.min(55,58) + "<br>");//返回两个值中最小数

}

-->

</SCRIPT>

<div><script>test();</script></div>

原文地址:https://www.cnblogs.com/zhuzhiyuan/p/2150152.html