javascript中的數學運算

來源:互聯網
上載者:User

標籤:

 1     var a1 = Math.pow(2,3);        //2的3次冪 2     var a2 = Math.round(.6);    //四捨五入 3     var a3 = Math.round(0.6);    //四捨五入,自行測試完成小數四捨五入 4     var a4 = Math.ceil(.6);        //向上求整 5     var a5 = Math.floor(.6);    //鄉下求整 6     var a6 = Math.abs(-5);        //求絕對值 7     var a7 = Math.max(3,5,8);    //返回最大值 8     var a8 = Math.min(3,5,8);    //返回最小值 9     var a9 = Math.random();        //產生一個大於等於0小於1。0的隨機數10     var a10 = Math.PI;            //圓周率11     var a11 = Math.E;            //自然對數的底數12     var a12 = Math.sqrt(3);        //3的平方根13     var a13 = Math.pow(3,1/3);    //3的立方根14     var a14 = Math.sin(0);        //三角函數 還有Math.cos,Math.atan等15     var a15 = Math.log(10);        //10的自然對數16     var a16 = Math.log(100)/Math.Ln10;    //以10為底的100的對數17     var a17 = Math.log(512)/Math.LN2;    //以2為底512的對數18     var a18 = Math.exp(3);                //e的三次冪

 

javascript中的數學運算

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.