Math对象

获取圆周率

Math.PI;

获取最大值

Math.max(1,2,3,4);  

获取最小值

Math(min(1,2,3,4);

四舍五入

Math.round(2.5);

向上取整

Math.ceil(1.1);

向下取整

Math.floor(2.9); 

获取0~1之间的随机数,不包括0和1

Math.random();
posted @ 2017-04-20 14:31  一剑烟雨  阅读(67)  评论(0编辑  收藏  举报