|
|
Floor function to get just lower integer of a number |
We can use math function floor to get the floor of a number or the largest integer which is equal to or lower than the given number.
So by using floor we can get the floor value of an number.
Here is the syntax.
Math.floor(number)
Let us try with some examples.
document.write (Math.floor(11.257)); // output 11
document.write ("<br>----<br>");
document.write (Math.floor(1.56)); // output 1
document.write ("<br>----<br>");
document.write (Math.floor(-3.564)); // output -4
document.write ("<br>----<br>");
document.write (Math.floor(-7.164)); // output -8
document.write ("<br>----<br>");
You can read the php math floor function
| |
| | |
|
|
|
|
|