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

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

vt.鋪地板;擊敗,打倒

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

javascript floor()方法 語法

作用:對一個數(shù)進行下舍入。

語法:Math.floor(x)

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

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

說明:floor() 方法執(zhí)行的是向下取整計算,它返回的是小于或等于函數(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>

運行實例 ?

點擊 "運行實例" 按鈕查看在線實例