js操作number的方法
2019-01-02 本文已影响63人
前端来入坑
- 向下取整 --- Math.floor(5.55)
Math.floor.png
-
向上取整 --- Math.ceil(5.25)
Math.ceil.png
-
四舍五入--- Math.round(0.105)
Math.round.png
-
丢弃小数部分,保留整数部分---parseInt(1.125)
parseInt.png
-
2.225.toFixed()
toFixed.png
toFixed.png
toFixed.png
