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: FLOOR Function



floor function Returns the largest integer less than or equal to a number.

Syntax:
floor(a number)

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


Example in HEAD Section

<html>
<head>
<title>Math.floor function</title>
<script languag="javascript">
document.write("Pass value is -45.65   and return value is = " + Math.floor(45.65) + "<br>");
document.write("Pass value is -45.65   and return value is = " + Math.floor(-45.65));
</script>
</head>
</html>


Example in BODY Section

<html>
<head>
<title>Math.floor function</title>
</head>
<body>
<script languag="javascript">
document.write("Pass value is -45.65   and return value is = " + Math.floor(45.65) + "<br>");
document.write("Pass value is -45.65   and return value is = " + Math.floor(-45.65));
</script>
</body>
</html>




OUTPUT

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

No comments:

Post a Comment

Google