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
相关文章
相关标签/搜索