首页 > Web开发 > 详细

js_ Math 方法

时间:2018-02-27 14:51:32      阅读:188      评论:0      收藏:0      [点我收藏+]
<html>
<head>
<title>js</title>
</head>
<body>
<script>
document.write(Math.PI+‘</br>‘); //3.141592653589793
document.write(Math.min(1,4,2)+‘</br>‘);// 最小数 1
document.write(Math.max(1,4,2)+‘</br>‘); // 最大数 4
document.write(Math.round(12.61)+‘</br>‘); //第一位小数四舍五入,和后面的小数没有关系 13
document.write(Math.ceil(12.11)+‘</br>‘);//向上舍入 13
document.write(Math.floor(12.61)+‘</br>‘); // 向下舍入 12
document.write(Math.floor(Math.random()*100+1)+‘</br>‘);//0~100之间的随机数
</script>
</body>
</html>

js_ Math 方法

原文:http://blog.51cto.com/zhuws/2073482

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!