Math内置方法

Math.abs([n]) // 获得n的绝对值 都是正数
Math.ceil(n) //n向上取整  floor向下取整
Math.round(n)// 四舍五入
Math.max(1,2,3)//取出最大数子
Math.pow(n,m) // n  的 多少 次 m
Math.sqrt(4)// 开平方 == 2 
Math.PI // 获得圆周率
Math.random() // 获取 0 - 1 之间的 随机数字

猜你喜欢

转载自blog.csdn.net/qq_45557681/article/details/115414002