Open In App
Related Articles

Lodash _.ceil() Method

Improve Article
Improve
Save Article
Save
Like Article
Like

Lodash _.ceil() method is used to compute numbers rounded up to precision.

Syntax:

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

Parameters:

  • 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: In this example, we are rounding up the given value.

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: In this example, we are rounding up the given value.

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: In this example, we are rounding up the given value.

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

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 03 Nov, 2023
Like Article
Save Article
Similar Reads
Related Tutorials