Javascript Math.ceil与Math.round与Math.floor区别
生活随笔
收集整理的這篇文章主要介紹了
Javascript Math.ceil与Math.round与Math.floor区别
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Javascript Math.ceil()與Math.round()與Math.floor()區別:
Math.ceil()向上舍入
alert(Math.ceil(20.1)) //輸出 21 alert(Math.ceil(20.5)) //輸出 21 alert(Math.ceil(20.9)) //輸出 21?Math.round標準的四舍五入
alert(Math.round(20.1)) //輸出 20 alert(Math.round(20.5)) //輸出 21 alert(Math.round(20.9)) //輸出 21?Math.floor()向下舍入
alert(Math.floor(20.1)) //輸出 20 alert(Math.floor(20.5)) //輸出 20 alert(Math.floor(20.9)) //輸出 20?
轉載于:https://www.cnblogs.com/kingwell/archive/2012/09/28/2706958.html
總結
以上是生活随笔為你收集整理的Javascript Math.ceil与Math.round与Math.floor区别的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 想要什么
- 下一篇: JQuery EasyUI DataGr