floor()

The floor method is used to return the largest whole number (an integer) that is equal to or less than the number specified as the parameter to the method. The syntax and examples explain this concept very well.

syntax:

Math.floor(number)

Math.foor(variableName)

EXAMPLE

theNumber = 234 * 4;

document.write("The 'floor; of the given number is : " + Math.floor(theNumber) )

The example first creates an object called theNumber, which is the product of the multiplication of 234 and 4. The document.write statement then writes some descriptive text along with the floor value of the theNumber value, which is passed as the parameter to the floor() method. The output should look like the following:



The 'floor' of the given number is : 936