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

n.楼层;地面,地板;底部;议员席

vt.铺地板;击败,打倒

第三人称单数: floors 复数: floors 现在分词: flooring 过去式: floored 过去分词: floored

javascript floor()方法 语法

作用:对一个数进行下舍入。

语法:Math.floor(x)

参数:x    必需。任意数值或表达式。    

返回:小于等于 x,且与 x 最接近的整数。

说明:floor() 方法执行的是向下取整计算,它返回的是小于或等于函数参数,并且与之最接近的整数。

javascript floor()方法 示例

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

<script type="text/javascript">
//在不同的数字上使用 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>

运行实例 »

点击 "运行实例" 按钮查看在线实例

热门推荐