JavaScript ceil() Method
Complete Math Object Reference
Definition and Usage
The ceil() method returns the value of a number rounded UPWARDS to the
nearest integer.
Syntax
Parameter |
Description |
x |
Required. A number |
Example
In the following example we will use the ceil() method on different numbers:
<script type="text/javascript">
document.write(Math.ceil(0.60) + "<br />");
document.write(Math.ceil(0.40) + "<br />");
document.write(Math.ceil(5) + "<br />");
document.write(Math.ceil(5.1) + "<br />");
document.write(Math.ceil(-5.1) + "<br />");
document.write(Math.ceil(-5.9));
</script>
|
The output of the code above will be:
Try-It-Yourself Demos
ceil()
How to use ceil().
Complete Math Object Reference
Learn XML with <oXygen/> XML Editor - Free Trial!
|
|
oXygen helps you learn to define,
edit, validate and transform XML documents. Supported technologies include XML Schema,
DTD, Relax NG, XSLT, XPath, XQuery, CSS.
Understand in no time how XSLT and XQuery work by using the intuitive oXygen debugger!
Do you have any XML related questions? Get free answers from the oXygen
XML forum
and from the video
demonstrations.
Download a FREE 30-day trial today!
|
|