JavaScript Math ceil() Method
The JavaScript Math.ceil method is used to return the smallest integer greater than or equal to a given number. The ceil() is always used as Math.ceil() since it is a static method of Math.
Syntax:
Math.ceil(value)
Parameters: This method accepts single parameters as mentioned above and described below:
- Value: It is the value that is to be tested for Math.ceil.
Return Value: The Math.ceil() method returns the smallest integer greater than or equal to the given number.
Below is an example of the Math ceil() Method.
Example 1: In this example, we will get the round-off value of 0.89.
javascript
console.log("Result : " + Math.ceil(.89)); |
Result : 1
Example 2: When a negative number is passed as a parameter.
javascript
console.log("Result : " + Math.ceil(-89.02)); |
Result : -89
Example 3: When zero is passed as a parameter.
javascript
console.log("Result : " + Math.ceil(0)); |
Result : 0
We have a complete list of Javascript Math Objects methods, to check those please go through this Javascript Math Object Complete reference article.
Supported Browsers:
- Google Chrome
- Firefox
- Opera
- Safari
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!
Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.

