第一種:傳統型javascript
使用Math對象的floor方法。java
Math.floor(testnum)
第二種:3d
使用~~運算符對類型轉換。code
~~testnum
第三種:對象
比較經常使用的。或零運算。blog
testnum | 0