js小数取整的几种方式

1,Math.ceil()方法向上取整,整数部分值+1:web eg:Math.ceil(3/2) 输出:2svg 2,Math.floor()方法向下取整,整数部分值不变:xml eg:Math.floor(3/2) 输出:1it 3,Math.round()方法四舍五入取整:webkit eg:Math.round(3/2) 输出:2方法 4,parseInt()方法 抛去小数部分,只取整数部
相关文章
相关标签/搜索