JavaScript -- Math

----- 016-Math.html -----javascript

 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 5     <title>Math</title>
 6 </head>
 7 <body>
 8 <script type="text/javascript">
 9     document.write("E= " + Math.E + "<br/>");
10     document.write("PI= " + Math.PI + "<br/>");
11     document.write("LN2= " + Math.LN2 + "<br/>");
12     document.write("LN10= " + Math.LN10 + "<br/>");
13     document.write("LOG2E= " + Math.LOG2E + "<br/>");
14     document.write("LOG10E= " + Math.LOG10E + "<br/>");
15     document.write("SQRT1_2= " + Math.SQRT1_2 + "<br/>");
16     document.write("SQRT2= " + Math.SQRT2 + "<br/>");
17 
18     document.write("Math.floor(5.5)= " + Math.floor(5.5) + "<br/>");
19     document.write("Math.round(5.5)= " + Math.round(5.5) + "<br/>");
20     document.write("Math.ceil(5.5)= " + Math.ceil(5.5) + "<br/>");
21     document.write("Math.abs(-5.555)= " + Math.abs(-5.555) + "<br/>");
22     document.write("Math.exp(2)= " + Math.exp(2) + "<br/>");
23     document.write("Math.max(5, 10)= " + Math.max(5, 10) + "<br/>");
24     document.write("Math.pow(2, 10)= " + Math.pow(2, 10) + "<br/>");
25     document.write("Math.random()= " + Math.random() + "<br/>");
26     document.write("Math.sqrt(2)= " + Math.sqrt(2) + "<br/>");
27 </script>
28 </body>
29 </html>

相關文章
相關標籤/搜索