Lodash - floor method



Syntax

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

Computes number rounded down to precision.

Arguments

  • number (number) − The number to round down.

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

Output

  • (number) − Returns the rounded down number.

Example

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

Output

5
5
lodash_math.htm
Advertisements