四舍五入round()
任务
补充右边编辑器代码,在script标签内,使用round()方法,计算3.3、-0.1、-9.9、8.9值。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Math </title>
<script type="text/javascript">
document.write(Math.round(3.3)+"<br/>");
document.write(Math.round(-0.1)+"<br/>");
document.write(Math.round(-9.9)+"<br/>");
document.write(Math.round(8.9));
</script>
</head>
<body>
</body>
</html>
本文详细介绍了JavaScript中四舍五入round()方法的使用方法及其特点,包括如何处理0.5的情况以及如何实现对不同数值的四舍五入。


901

被折叠的 条评论
为什么被折叠?



