Returns the largest integer less than or equal to a number.
Method of Math
Static
Syntax
floor( x )
Parameters
Parameter | Description |
---|---|
x | 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.
Examples
The following function returns the floor value of the variable x:
If you pass 45.95 to getFloor, it returns 45; if you pass -45.95, it returns -46.