Here you can find a number of examples on Java Script.Please find the various kinds of examples listed on the right side of this site. If you don't find anything on Java Script then please write to us or leave a commnet. We are pleased to help and find the solution of your problem.

Javascript: CEIL Function



ceil Function returns the smallest integer greater than or equal to a number.

Syntax:
ceil(a numebr)

Description:
Because ceil is a static method of math, you always use it as Math.ceil(), rather than as a method of a Math object you created.


Example in HEAD Section
<html>
<head>
<title>Math.ceil function</title>
<script language="javascript">
document.write("Pass value is -45.65   and return value is = " + Math.ceil(45.65) + "<br>");
document.write("Pass value is -45.65   and return value is = " + Math.ceil(-45.65));
</script>
</head>
</html>


Example in BODY Section
<html>
<head>
<title>Math.ceil function</title>
</head>
<body>
<script language="javascript">
document.write("Pass value is -45.65   and return value is = " + Math.ceil(45.65) + "<br>");
document.write("Pass value is -45.65   and return value is = " + Math.ceil(-45.65));
</script>
</body>
</html>




OUTPUT

Pass value is -45.65 and return value is = 46
Pass value is -45.65 and return value is = -45

No comments:

Post a Comment

Google