Math.max() 最大值
    Math.min() 最小值
    Math.ceil() 上取整
    Math.floor() 下取整
    Math.round() 四舍五入取整
    Math.random() 随机数 0<num<1

    1. <!DOCTYPE html>
    2. <html lang="en">
    3. <head>
    4. <meta charset="UTF-8">
    5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
    6. <title>Document</title>
    7. </head>
    8. <body>
    9. <script>
    10. /*
    11. Math.max();
    12. Math.min();
    13. Math.ceil() 上取整
    14. Math.floor() 下取整
    15. Math.round() 四舍五入取整
    16. Math.random() // 0<=num<1
    17. 1-100
    18. */
    19. /*
    20. Math.random()*100
    21. 0<=num<99.999
    22. Math.floor(Math.random()*100)
    23. 0<=num<99;
    24. Math.floor(Math.random()*100)+1
    25. 1<=num<100;
    26. */
    27. var num = 12.66;
    28. console.log(Math.ceil(num))
    29. console.log(Math.floor(num))
    30. console.log(Math.round(num))
    31. console.log(Math.random())
    32. </script>
    33. </body>
    34. </html>