1、取整
1.1 向下取整
Math.floor() 和 parseInt()
1.2 向上取整
Math.ceil
1.3 四舍五入取整
Math.round(2.5) // 3Math.round(2.45) // 22、四舍五入保留小数点后n位
(2.35).toFixed(1) // 2.4(2.35124).toFixed(7) // 2.35124001、取整
1.1 向下取整
Math.floor() 和 parseInt()
1.2 向上取整
Math.ceil
1.3 四舍五入取整
Math.round(2.5) // 3Math.round(2.45) // 22、四舍五入保留小数点后n位
(2.35).toFixed(1) // 2.4(2.35124).toFixed(7) // 2.3512400版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。