Skip to content

JavaScript Math floor() | Method

  • by

JavaScript Math floor() method is used to round down a number to the next smallest integer. This function returns round a number DOWN to the nearest integer.


If the given number is already an integer, the floor() method returns it directly.

Note: Math.floor() returns 0 for null rather than NaN.

JavaScript Math floor() Method

A simple example code decreases the given number up to the closest integer value.

<!DOCTYPE html>





JavaScript Math floor Method

Do comment if you have any doubts or suggestions on this JS Math function topic.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Your email address will not be published. Required fields are marked *