Saturday, October 25, 2025
HomeLanguagesJavascriptLodash _.ceil() Method

Lodash _.ceil() Method

The _.ceil() method is used to compute number rounded up to precision.

Syntax:

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

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

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

Return Value: This method returns the rounded up 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 _.ceil() method 
let gfg = _.ceil(2.4);
         
// Printing the output  
console.log(gfg)


 Output:

3

Example 2: 

Javascript




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


 Output:

3.01

Example 3:   

Javascript




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


 Output:

1700
RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS