JavaScript中的Math.ceil()、Math.round()、Math.floor()

1. Math.ceil():向上取整(指取大于该浮点数的最小整数)

2. Math.round():四舍五入取整(注意:当该浮点数距离两端整数一样时,取较大的那个整数,如Math.round(-1.5)=-1)

3. Math.floor():向下取整(指取小于该浮点数的最大整数)

原文地址:https://www.cnblogs.com/jingjing-blog/p/4976835.html