JS-Math内置对象

 

 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4 <meta charset="UTF-8">
 5 <title>uvi</title>
 6      <link rel="stylesheet" href="style.css" type="text/css">
 7 </head>
 8 <body>
 9    <script>
10       document.write(Math.round(2.5)+"<br/>");//四舍五入=3
11       document.write(parseInt(Math.random()*10)+"<br/>");//从0到10
12       document.write(Math.max(10,20,4,1)+"<br/>");//最大值
13       document.write(Math.min(10,20,4,1)+"<br/>");//最小值
14       document.write(Math.abs(-10)+"<br/>");//绝对值
15    </script>
16    
17 </body>
18 </html>

 

posted @ 2016-08-10 10:24  UniqueColor  阅读(204)  评论(0编辑  收藏  举报