Skip to content

floor

js
_.floor(number, [precision=0])

计算 number 向下舍入到 precision

¥Computes number rounded down to precision.

新增于

¥Since

3.10.0

参数

¥Arguments

  1. number (数值):向下舍入的数字。

    ¥number (number): The number to round down.

  2. [precision=0] (数值):要向下舍入到的精度。

    ¥[precision=0] (number): The precision to round down to.

返回

¥Returns

(数值):返回向下舍入的数字。

¥(number): Returns the rounded down number.

示例

¥Example

js
_.floor(4.006);
// => 4

_.floor(0.046, 2);
// => 0.04

_.floor(4060, -2);
// => 4000

Lodash v4.17 中文网 - 粤ICP备13048890号