Math内置对象的常见API(http://www.w3school.com.cn/jsref/jsref_obj_math.asp)
Math.random()   取值范围[0~1) 
Math.round()    四舍五入   Math.round(-11.5) //-11 (向上取整)
Math.max()      求最大值
Math.min()      求最小值
Math.abs()      求绝对值
Math.sqrt()     求开平方
Math.pow(x,y)   x的y次方  Math.pow(27,1/3) //3 开三次方
Math.floor()    向下取整
Math.ceil()     向上取整

三角函数
Math.sin()
Math.cos()
Math.tan()
JavaScript Math
尝试使用DIV画出 正弦曲线
JavaScript Math



//随机生成一个min-max之间的数字(包含min和max)
function randomInt(min, max) {
	return Math.round(Math.random() * (max - min)) + min;
}





相关文章:

  • 2022-12-23
  • 2021-12-08
  • 2022-12-23
  • 2021-07-30
  • 2021-03-31
  • 2021-10-16
  • 2021-06-30
  • 2021-06-01
猜你喜欢
  • 2022-03-08
  • 2022-02-08
  • 2021-12-18
  • 2021-12-13
  • 2021-10-08
相关资源
相似解决方案