Pages

Javascript Math - ceil Method

Description:

This method returns the smallest integer greater than or equal to a number.

Syntax:

Math.ceil( x ) ;
Here is the detail of parameters:
  • x : A numbers.

Return Value:

Returns the smallest integer greater than or equal to a number.

Example:

<html>
<head>
<title>JavaScript Math ceil() Method</title>
</head>
<body>
<script type="text/javascript">

var value = Math.ceil(45.95);
document.write("First Test Value : " + value ); 
  
var value = Math.ceil(45.20);
document.write("<br />Second Test Value : " + value ); 

var value = Math.ceil(-45.95);
document.write("<br />Third Test Value : " + value ); 

var value = Math.ceil(-45.20);
document.write("<br />Fourth Test Value : " + value ); 
</script>
</body>
</html>
This will produce following result:
First Test Value : 46
Second Test Value : 46
Third Test Value : -45
Fourth Test Value : -45 
 
+JavaScript +JavaScript Frameworks Links +Javascript Development 
+JavaScript's and More, Software and Marketing +JavascriptU +JavaScriptOn 
+Javascript Problems +JavaScriptOn 
 +javaScript is a creek in West Virginia in the summe  
+enJineS +JavascriptU +Javascript Tutor   

No comments:

Flag Counter
| Copyright © 2013 Remote Tutor