The Wayback Machine - https://web.archive.org/web/20240118174211/https://www.geeksforgeeks.org/javascript-math-ceil-method/
Open In App
Related Articles

JavaScript Math ceil() Method

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

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));


Output

Result : 1

Example 2: When a negative number is passed as a parameter.

javascript




console.log("Result : " + Math.ceil(-89.02));


Output

Result : -89

Example 3: When zero is passed as a parameter.

javascript




console.log("Result : " + Math.ceil(0));


Output

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

Learn to code easily with our course Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!

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.
Last Updated : 01 Aug, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads
Complete Tutorials