js的向上取整(Math.ceil)向下取整(Math.floor)四捨五入(Math.round)

<script language="javascript"> 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) //結果
相關文章
相關標籤/搜索