Download Fore_End/JavaScript/ECMAScript/ECMAScript_object/04_Math对象.html from zxy0307/JavaWeb: direct link, hf CLI and curl.
- Browser
- Download file 894 Bytes
-
https://huggingface.co/zxy0307/JavaWeb/resolve/main/Fore_End/JavaScript/ECMAScript/ECMAScript_object/04_Math%E5%AF%B9%E8%B1%A1.html
- Command line
-
hf download hf://zxy0307/JavaWeb/Fore_End/JavaScript/ECMAScript/ECMAScript_object/04_Math对象.html
-
curl -L -o 04_Math对象.html https://huggingface.co/zxy0307/JavaWeb/resolve/main/Fore_End/JavaScript/ECMAScript/ECMAScript_object/04_Math%E5%AF%B9%E8%B1%A1.html
894 Bytes
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Math对象</title> | |
| </head> | |
| <body> | |
| <script> | |
| /* | |
| 5. Math:数学对象 | |
| 1. 创建: | |
| * 特点:Math对象不用创建,直接使用。 Math.方法名(); | |
| 2. 方法: | |
| random():返回 0 ~ 1 之间的随机数。 含0不含1 | |
| ceil(x):对数进行上舍入。 | |
| floor(x):对数进行下舍入。 | |
| round(x):把数四舍五入为最接近的整数。 | |
| 3. 属性: | |
| PI | |
| */ | |
| document.write(Math.PI + "<br/>"); | |
| document.write(Math.random() + "<br/>"); | |
| document.write(Math.round(3.14) + "<br/>"); | |
| document.write(Math.ceil(3.14) + "<br/>"); | |
| document.write(Math.floor(3.14) + "<br/>"); | |
| /** | |
| * 取 1~100 之间的随机整数 | |
| */ | |
| var ret = Math.floor(Math.random() * 100) + 1; | |
| document.write(ret + "<br/>"); | |
| </script> | |
| </body> | |
| </html> |