26

js的技巧 - 木易杨@ - SegmentFault 思否

 4 years ago
source link: https://segmentfault.com/a/1190000020893439
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Number.isFinite(12); // true; 其他类型都为falseMath.trunc方法用于去除一个数(正负都可以)的小数部分,返回整数部分。console.log(Math.trunc(3.1));// 兼容性写法// Math.trunc = Math.trunc || function(x) {// return x < 0 ? Math.ceil(x) : Math.floor(x);// };

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK