js几个取整函数

来源:互联网 发布:软件立项建议书 编辑:程序博客网 时间:2024/04/29 18:55

Math.floor()    Math对象的方法--取比当前数值小的最大整数(下取整)。

Math.ceil()      Math对象的方法--取比当前数值大的最小整数(上取整)。

Math.round()  Math对象的方法--四舍五入。

toFixed()         Number对象的方法--四舍五入保留n位小数。




转自:http://wangjingyi.iteye.com/blog/1441509

0 0