问答详情
源自:7-15 四舍五入round()

运用数组的方法

<script type="text/javascript">
    var a=["3.3","-0.1","-9.9","8.9"];
        for(var i=0;i<a.length;i++)
        {
            document.write(Math.round(a[i]));
        }


提问者:big_briuses 2015-03-29 17:07

个回答

  • qq_灰色头像_17
    2017-08-26 10:19:17

    <!DOCTYPE html>

    <html>

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Math </title>

    <script type="text/javascript">

    var a=[3.3,-0.1,-9.9,8.9];


     for(i in a){


         document.write(Math.round(a[i])+'<br/>');


     }

    </script>

    </head>

    <body>

    </body>

    </html>


  • 慕桂英2847998
    2015-12-20 17:28:42

    diaodiaode