欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JavaScript floor() 方法

定義和用法

floor() 方法可對(duì)一個(gè)數(shù)進(jìn)行下舍入。

語(yǔ)法

Math.floor(x)
參數(shù) 描述
x 必需。任意數(shù)值或表達(dá)式。

返回值

小于等于 x,且與 x 最接近的整數(shù)。

說(shuō)明

floor() 方法執(zhí)行的是向下取整計(jì)算,它返回的是小于或等于函數(shù)參數(shù),并且與之最接近的整數(shù)。

實(shí)例

在本例中,我們將在不同的數(shù)字上使用 floor() 方法:

<script type="text/javascript">

document.write(Math.floor(0.60) + "<br />")
document.write(Math.floor(0.40) + "<br />")
document.write(Math.floor(5) + "<br />")
document.write(Math.floor(5.1) + "<br />")
document.write(Math.floor(-5.1) + "<br />")
document.write(Math.floor(-5.9))

</script>

輸出:

0
0
5
5
-6
-6

TIY

floor()
如何使用 floor() 方法。