1. Math.ceil()用作向上取整。//Math.ceil(0.56)取值为1
2. Math.floor()用作向下取整。//Math.floor(0.56)取值为0
3. Math.round() 我们数学中常用到的四舍五入取整。//Math.round(0.56)取值为1
希望能帮助你!!
function abc(n){return Math.ceil(n)
}
//Math.ceil() 向上取整
//Math.floor() 向下取整
//Math.round() 四舍五入
1. Math.ceil()用作向上取整。//Math.ceil(0.56)取值为1
2. Math.floor()用作向下取整。//Math.floor(0.56)取值为0
3. Math.round() 我们数学中常用到的四舍五入取整。//Math.round(0.56)取值为1
希望能帮助你!!
function abc(n){return Math.ceil(n)
}
//Math.ceil() 向上取整
//Math.floor() 向下取整
//Math.round() 四舍五入