代码示例:(标识:eg_js_math_round)
<!DOCTYPE html>
<html>
<body>

<h1>JavaScript Math.round()</h1>

<p>Math.round(x) 返回 x 四舍五入到最接近的整数的值:</p>

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML = Math.round(4.4);
</script>

</body>
</html>
运行结果: