zoukankan      html  css  js  c++  java
  • JavaScript Math

    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()
    尝试使用DIV画出 正弦曲线



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





  • 相关阅读:
    audio_policy.conf说明(翻译)
    Qt
    linux C
    Linux C
    Linux C
    Qt
    Qt
    JSON
    JSON
    Qt
  • 原文地址:https://www.cnblogs.com/fanlinqiang/p/7741225.html
Copyright © 2011-2022 走看看