首页 > 编程语言 > 详细

JavaScript中的Math

时间:2016-09-21 23:44:58      阅读:417      评论:0      收藏:0      [点我收藏+]
//math()
//Pl
document.write(Math.PI+‘<br>‘);
var math=10.1;
var math1=10.9;
//四舍五入round()
document.write(Math.round(math)+‘<br>‘);
//进一法  ceil
document.write(Math.ceil(math)+"<br>");
//退一法  floor
document.write(Math.floor(math)+"<br>");
//获取最小值min()
document.write(Math.min(1,10)+‘<br>‘);
//获取最大值max()
document.write(Math.max(10,1)+‘<br>‘);
//随机数random()
document.write(Math.random());


本文出自 “web” 博客,请务必保留此出处http://web66.blog.51cto.com/10442650/1854948

JavaScript中的Math

原文:http://web66.blog.51cto.com/10442650/1854948

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