Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Lodash _.floor() Method

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The _.floor() method is used to compute numbers rounded down to precision means it rounded down to the floor value.

Syntax:

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

Parameters: This method accepts two parameters as mentioned above and described below:

  • number: This parameter holds the number to round down.
  • [precision = 0]: This parameter holds the precision to round down to.

Return Value: This method returns the rounded down number.

Example 1: Here, const _ = require(‘lodash’) is used to import the lodash library into the file.

Javascript




// Requiring the lodash library  
const _ = require("lodash"); 
   
// Use of _.floor() method 
let gfg = _.floor(2.4);
         
// Printing the output  
console.log(gfg)

 
Output:

2

Example 2:  

Javascript




// Requiring the lodash library  
const _ = require("lodash"); 
   
// Use of _.floor() method 
let gfg = _.floor(0.525, 2);
         
// Printing the output  
console.log(gfg)

Output:

0.52

Example 3:  

Javascript




// Requiring the lodash library  
const _ = require("lodash"); 
   
// Use of _.floor() method 
let gfg = _.floor(1680, -2);
         
// Printing the output  
console.log(gfg)

 
Output:

1600

My Personal Notes arrow_drop_up
Last Updated : 01 Sep, 2020
Like Article
Save Article
Similar Reads
Related Tutorials