Math.floor()
14th January 2021
0 Comments
Programming Language
JavaScript [Version: ECMAScript (ECMA-262)]
Syntax
Typical Usage
Rounds a number down to the next largest integer less than or equal to the given value.
Accepted Parameters
value (integer) (Required): The float value you wish to round down.
Return Value(s)
The number rounded down.Examples of Math.floor()
Example 1
console.log(Math.floor(2.1234))
// Output = 2
The above will output 2.
Example 2
console.log(Math.floor(68.7654))
// Output = 68
The above will output 68.
Similar Functions in Other Languages
- PHP: floor()
Was This Helpful?
If this post has helped you, please let me know. Your feedback will be highly appreciated and will help me build better content.