javascript中对象之基础之Math对象用法

javascript中对象之基础之Math对象用法

1,Math.round()
Math.round(x) 的返回值是 x 四舍五入为最接近的整数:

2,Math.pow()
Math.pow(x, y) 的返回值是 x 的 y 次幂:

3,Math.sqrt()
Math.sqrt(x) 返回 x 的平方根:

4,Math.abs()

Math.abs(x) 返回 x 的绝对(正)值:

5,Math.ceil()

Math.ceil(x) 的返回值是 x 上舍入最接近的整数:

6,Math.floor()

Math.floor(x) 的返回值是 x 下舍入最接近的整数:

7,Math.sin()

Math.sin(x) 返回角 x(以弧度计)的正弦(介于 -1 与 1 之间的值)。

8,Math.random()

Math.random() 返回介于 0(包括) 与 1(不包括) 之间的随机数:

9,Math.min() 和 Math.max()

Math.min() 和 Math.max() 可用于查找参数列表中的最低或最高值:

文章来自 96net.com.cn

 

 

posted @ 2020-03-08 15:51  学无边涯  阅读(131)  评论(0编辑  收藏  举报