今天搞背景色rbg的测试的时候发现Math这边的东西有点生疏了特来复习一下。
//向下取整 floor
Math.floor(0.99) //输出0
Math.floor(-0.99) //输出-1
//向上取整 ceil
Math.ceil(0.99) //输出1
Math.ceil(-0.99) //输出0
//四舍五入
Math.round(1.9) //输出2
Math.round(-1.45) //输出 -1
Math.random();随机数的取整
最新推荐文章于 2025-05-25 21:52:04 发布