1. Number.isFinite 检测一个数值是否为有限数
console.log(Number.isFinite(100)); //true
console.log(Number.isFinite(100/0)); //false
console.log(Number.isFinite(Infinity)); //false
2. Number.isNaN 检测一个数值是否为NaN
console.log(Number.isNaN(123)); //false
3. Number.parseInt Number.parseFloat 字符串转整数
console.log(Number.parseInt('5123love')); //5123
console.log(Number.parseFloat('3.12神奇')); //3.12
4. Number.isInteger 判断一个数是否为整数
console.log(Number.isInteger(5)); //true
console.log(Number.isInteger(5.12)); //false
5. Math.trunc 将数字的小数部分抹掉
console.log(Math.trunc(3.5)); //3
6. Math.sign 判断一个数到底是正数 负数 还是零
console.log(Math.sign(100)); // 1
console.log(Math.sign(0)); // 0
console.log(Math.sign(-100)); // -1