762 B
762 B
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