第一种:传统型javascript
使用Math对象的floor方法。java
Math.floor(testnum)
第二种:3d
使用~~运算符对类型转换。code
~~testnum
第三种:对象
比较经常使用的。或零运算。blog
testnum | 0