js方法将小数转化为整数

Math.round(要转化的数);

这种方法是四舍五入的。

例如:var x1 = Math.round(11.3);

           var x2 = Math.round(11.6);

那么结果为:x1 == 11

                      x2 == 12

猜你喜欢

转载自blog.csdn.net/dd2016124/article/details/85783058