- 向下取整 --- 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

向上取整 --- Math.ceil(5.25)
四舍五入--- Math.round(0.105)
丢弃小数部分,保留整数部分---parseInt(1.125)
2.225.toFixed()
本文标题:js操作number的方法
本文链接:https://www.haomeiwen.com/subject/nfhmfqtx.html
网友评论