javascript中取整函数

来源:互联网 发布:博时现金宝 知乎 编辑:程序博客网 时间:2024/05/21 17:02

parseInt(5/2)                 2 ;

praseFloat() //取幅点型

 

4舍5入的是Math.round(xxxxxxxx)   Math.round(1.4)      1     Math.round(1.5)      2

取下限是Math.floor(xxxxxxxxx)      Math.floor(1.1)        1

取上限是Math.ceil(xxxxxxxx)           Math.ceil(1.1)          2