英 [fl?:(r)]? ?美 [fl?r, flor]??

n.樓層;地面,地板;底部;議員席

vt.鋪地板;擊敗,打倒

第三人稱單數(shù): floors 復(fù)數(shù): floors 現(xiàn)在分詞: flooring 過(guò)去式: floored 過(guò)去分詞: floored

javascript floor()方法 語(yǔ)法

作用:對(duì)一個(gè)數(shù)進(jìn)行下舍入。

語(yǔ)法:Math.floor(x)

參數(shù):x ? ?必需。任意數(shù)值或表達(dá)式。? ??

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

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

javascript floor()方法 示例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script type="text/javascript">
//在不同的數(shù)字上使用 floor() 方法
    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>

</body>
</html>

運(yùn)行實(shí)例 ?

點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例