js对数字取整和保留小数
取整math.ceil(5/2):向上取整math.round(5/2):四舍五入取整math.floor(5/2):向下取整打开浏览器F12,console中输入可以看到结果Math.ceil(5/2)// 输出 3Math.ceil(2.4)// 输出3Math.round(5/2)// 输出3 四舍五入Math.round(2.499)// 输出2Math.round(2.6)// 输出3Math.floor(5/2)// 输出2Math.floor(2.