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

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

<p>Math.floor(x) 返回 x 被下舍入为最接近整数的值:</p>

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

<script>
document.getElementById("demo").innerHTML = Math.floor(4.7);
</script>

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