Lodash教程

Lodash floor method

语法

_.floor(number, [precision=0])
Computes number rounded down to precision.

参数

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

输出

(number) − Returns the rounded down number.

实例

var _ = require('lodash');
 
console.log(_.floor(0.004));
console.log(_.floor(0.004,2));
Save the above program in tester.js. Run the following command to execute this program.

Command

\>node tester.js

输出

5
5
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4