Friday, September 5, 2025
HomeLanguagesJavascriptJavaScript Math floor() Method

JavaScript Math floor() Method

The Javascript Math.floor() method is used to round off the number passed as a parameter to its nearest integer in a Downward direction of rounding i.e. towards the lesser value.

Syntax: 

Math.floor(value)

Parameters: This method accepts a single parameter as mentioned above and described below: 

  • Value: It is the value that is to be tested for Math.floor.

Return Value: The Math.floor() method returns the smallest integer greater than or equal to the given number.

Below is an example of the Math floor() Method. 

Example 1: This example rounds off the value of the parameter to 0.

javascript




console.log("Result : " + Math.floor(.89));


Output

Result : 0

Example 2: When a negative number is passed as a parameter. 

javascript




console.log("Result : " + Math.floor(-89.02));


Output

Result : -90

Example 3: When zero is passed as a parameter.

javascript




console.log("Result : " + Math.floor(0));


Output

Result : 0

We have a complete list of Javascript Math Objects methods, to check those please go through this Javascript Math Object Complete reference article.

Supported Browsers: 

  • Google Chrome 1 and above
  • Firefox 1 and above
  • Opera 3 and above
  • Safari 1 and above
RELATED ARTICLES

2 COMMENTS

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6634 POSTS0 COMMENTS
Nicole Veronica
11801 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11863 POSTS0 COMMENTS
Shaida Kate Naidoo
6750 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6701 POSTS0 COMMENTS
Umr Jansen
6718 POSTS0 COMMENTS