Math.round(),Math.ceil(),Math.floor(),Math.pow(x,y)的区别
Math.round()
round 附近 四舍五入 取附近的整数
Math.round(11.5)=12
Math.round(11.4)=11
Math.round(-11.6)=-12
Math.round(-11.4)=-11
Math.ceil()
ceil 天花板 取大于当前小数的整数
Math.ceil(11.2)=12
Math.ceil(-11.5)=-11
Math.floor()
floor 地板 取小于当前小数的整数
Math.floor(11.5)=11
Math.floor(-11.5)=-12
Math.pow(x,y)
x的y次幂
Math.pow(-2,3)=-8
Math.pow(2,3) =8
😊