js向上取整 向下取整四捨五入方法總結

Math.floor(5.55) //向下取整 結果爲5 Math.floor(5.99) //向下取整 結果爲5 Math.ceil(5.21) //向上取整,結果爲6 Math.ceil(5.88) //向上取整,結果爲6 Math.round(5.78) //四捨五入 結果爲6 Math.round(5.33) //結果爲5
相關文章
相關標籤/搜索