freeCodeCamp/guide/chinese/javascript/standard-objects/math/math-floor/index.md

762 B
Raw Blame History

title localeTitle
Math Floor 数学楼层

数学楼层

Math.floor()是Math标准对象的一种方法它将给定数字向下舍入到下一个整数。请注意对于负数这意味着数字将从“0”而不是更小的绝对值舍入因为Math.floor()返回小于或等于给定数字的最大整数。

例子

Math.floor(0.9)  //  0 
 Math.floor(1.3)  //  1 
 Math.floor(0.5)  //  0 
 Math.floor(-0.9) // -1 
 Math.floor(-1.3) // -2 

更多信息: