javascript基础笔记(十三)之Math对象

来源:互联网 发布:专家系统 数据库设计 编辑:程序博客网 时间:2024/06/11 02:09
<span style="font-size:18px;"></span>
<span style="font-size:18px;">js的Math对象           *数学的运算           *里面都是静态方法   *ceil得到向上舍入   *floor得到向下舍入   *round得到四舍五入   *random得到随机数(伪随机数0-1)</span>
<span style="font-size:18px;">           举例几个常用的例子,其他的自己查</span>
<span style="font-size:18px;">代码:</span>
<span style="font-size:18px;">    </span><pre name="code" class="html"><!DOCTYPE html><html> <head>     <title>js的math对象</title>  </head> <body>       <script type="text/javascript">            var mm=10.4;document.write("old:"+mm);document.write("<br/>");    document.write("ceil:"+Math.ceil(mm));//向上舍入    document.write("<br/>");document.write("floor:"+Math.floor(mm));//向下舍入document.write("<br/>");document.write("round:"+Math.round(mm));//四舍五入document.write("<hr/>");document.write(Math.floor(Math.random()*10));    document.write("<hr/>");document.write(Math.pow(2,3));    </script> </body></html>

                                             
0 0
原创粉丝点击