JavaScript round() 方法【每日一段代码95】

<html>
<body>
<script type="text/javascript">
document.write(Math.round(0.60)+"<br />");
document.write(Math.round(0.50)+"<br />");
document.write(Math.round(0.49)+"<br />");
document.write(Math.round(-4.50)+"<br />");
document.write(Math.round(-4.60));
</script>
</body>
</html>

 

round() 方法可把一个数字舍入为最接近的整数。】

posted on 2012-04-24 21:44  Cosimo  阅读(158)  评论(0编辑  收藏  举报

导航