var num = -8.8;
console.log(num | 0);
console.log(~~num);
console.log(num >> 0)
console.log(Math.floor(num));
num = 8.8;
console.log(num | 0);
console.log(~~num);
console.log(num >> 0)
console.log(Math.floor(num));
|,~~,>>只是物理的去掉后面的.
Math.floor是取当前值最远的整数.