es6中的Math.trunc()和parseInt()以及对比Math.ceil()和Math.floor()的优势

1.Math.trunc()做用就是去除一个数的小数部分。函数 2.Math.trunc()和parseInt(),乍一看这个方法彻底能够用parseInt()代替,.net 可是对于Math.trunc()若是参数的字符串内部会先使用Number将其先转为数值blog console.log(parseInt('13.14g'));//13 console.log(Math.trunc('13.
相关文章
相关标签/搜索