JS四舍五入、向上/下取整

Math是javascript的一个内部对象,该对象的方法主要是一些数学计算方法
floor:下退 Math.floor(12.9999) = 12
ceil:上进 Math.ceil(12.1) = 13;
round: 四舍五入 Math.round(12.5) = 13 Math.round(12.4) = 12

猜你喜欢

转载自blog.csdn.net/weixin_46099269/article/details/111310695