欢迎找我内推微软

JavaScript中Math常用方法

Math.E ——2.718281828459045,算数常量e

Math.PI——3.141592653589793,圆周率

Math.abs(x) ——x的绝对值

Math.sqrt(x)——x的平方根

Math.pow(x,y)——x的y次幂

Math.random()——0-1之间的随机数

Math.ceil(x)——x的上舍入

Math.round(x)——四舍五入

Math.floor(x)——x的下舍入

Math.sin(x)——x的正弦

Math.cos(x)——x的余弦

Math.exp(x)——e的x次方

Math.log(x)——x的自然对数

Math.max(a1,a2,...,an)——返回最大值

Math.min(a1,a2,...,an)——返回最小值

posted @ 2018-12-22 17:10  zmj97  阅读(149)  评论(0编辑  收藏  举报
欢迎找我内推微软