Math.ceil( ) In JavaScript
The Math.ceilfunction in JavaScript is used to return the smallest integer greater than or equal to a given number.
Ceil() is always used as Math.ceil() since it is a static method of Math.
Syntax:
Math.ceil(value)
Parameters Used:
Value :It is the value which is to be tested for Math.ceil.
Return Value:
The Math.ceil() function returns the smallest integer greater than or equal to the given number.
Examples:
Input : Math.ceil(.89)
Output : 1
Input : Math.ceil(-89.02)
Output : -89
Input : Math.ceil(0)
Output : 0
- When a number less than zero is passed as a parameter.
<scripttype="text/javascript">document.write("Output : " + Math.ceil(.89));</script>chevron_rightfilter_noneOutput:
Output : 1
- When a negative number is passed as a parameter.
<scripttype="text/javascript">document.write("Output : " + Math.ceil(-89.02));</script>chevron_rightfilter_noneOutput:
Output : -89
- When zero is passed as a parameter.
<scripttype="text/javascript">document.write("Output : " + Math.ceil(0));</script>chevron_rightfilter_noneOutput:
Output : 0
- Introduction to JavaScript Course | Learn how to Build a task tracker using JavaScript
- JavaScript Course | Understanding Code Structure in JavaScript
- JavaScript Course | Data Types in JavaScript
- JavaScript Course | Printing Hello World in JavaScript
- JavaScript Course | Logical Operators in JavaScript
- JavaScript Course | Conditional Operator in JavaScript
- JavaScript Course | Variables in JavaScript
- JavaScript Course | Functions in JavaScript
- JavaScript Course | Operators in JavaScript
- JavaScript Course | Objects in JavaScript
- JavaScript Course | JavaScript Prompt Example
- JavaScript Course | Loops in JavaScript
- JavaScript vs Python : Can Python Overtop JavaScript by 2020?
- How to include a JavaScript file in another JavaScript file ?
- Map.get( ) In JavaScript
Recommended Posts:
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



