JavaScript math floor() method

The JavaScript math floor() method is used to get the largest integer value, either lower than or equal to a number.
Syntax:

Math.floor(n)

Parameters
n: It represents the number.

Returns
Largest integer value which will be either lower than or equal to the specified number.

Example

<!DOCTYPE html>
<html>
<body>
<script>  
document.writeln(Math.floor(2.7));  
</script>  
</body>
</html>

Output

2
Please Share