标签:
Math.ceil()向上舍入
| 
 1 
2 
3 
 | 
alert(Math.ceil(20.1)) //输出 21alert(Math.ceil(20.5)) //输出 21alert(Math.ceil(20.9)) //输出 21 | 
Math.round标准的四舍五入
| 
 1 
2 
3 
 | 
alert(Math.round(20.1)) //输出 20alert(Math.round(20.5)) //输出 21alert(Math.round(20.9)) //输出 21 | 
Math.floor()向下舍入
| 
 1 
2 
3 
 | 
alert(Math.floor(20.1)) //输出 20alert(Math.floor(20.5)) //输出 20alert(Math.floor(20.9)) //输出 20 | 
Javascript Math.ceil()与Math.round()与Math.floor()区别
标签:
原文地址:http://www.cnblogs.com/xcsn/p/4677583.html