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:
- 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.
Example 1: This example rounds off the value of the parameter to 0.
javascript
console.log("Result : " + Math.floor(.89));
|
Example 2: When a negative number is passed as a parameter.
javascript
console.log("Result : " + Math.floor(-89.02));
|
Example 3: When zero is passed as a parameter.
javascript
console.log("Result : " + Math.floor(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
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!
Looking for a place to share your ideas, learn, and connect? Our Community portal is just the spot! Come join us and see what all the buzz is about!
Last Updated :
15 Dec, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...