javaScript中Math对象使用方法汇总
Math 对象使用方法汇总
Math 对象
作用
Math.abs( )
取绝对值
Math.min.apply( null , 数组名)
找数组里的最小值
Math.max.apply(null , 数组名)
找数组里的最大值
Math.floor ( -2.3 )
向下取整 -3
Math.ceil ( -2.3 )
向上取整 -2
Math.round()
四舍五入 注意: 如 -2.5 结果是 -2
Math.random(没有参数)
随机[0~1)之间的数
原创
2021-11-22 09:13:53 ·
268 阅读 ·
0 评论