Math对象的使用

1. Math.floor() === 向下取整

2.Math.random() === 取一个浮点随机数

3.Math.round() === 四舍五入后一个最接近的整数

4.Math.ceil() === 向上取整

5.Math.abs(x) 函数返回指定数字 “x“ 的绝对值。

 

更多参考MDN WebDocs:

https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Math/floor

猜你喜欢

转载自www.cnblogs.com/JaniceDong/p/9022985.html