Math的方法

1.Math.PI

  表示圆周率

2.Math.abs()

  计算一个数的绝对值

3.Math.ceil()

  对一个数进行向上取整

4.Math.floor()

  对一个数进行向下取整

5.Math.round()

  用来生成一个0-1的随机数

  Math.round(Math.round()*10)

  生成一个0-x之间的随机数

6.Math.pow(x,y)

  返回x的y次方

7.Math.sqrt()

  对一个进行开方运算

原文地址:https://www.cnblogs.com/ccc0114/p/9816519.html