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()

  对一个进行开方运算

posted @ 2018-10-19 15:09  前端之巅  阅读(444)  评论(0编辑  收藏  举报