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)
Math.floor(n)
Math.floor(n)
Parameters
n: It represents the number.
Returns
The largest integer value 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>
<!DOCTYPE html>
<html>
<body>
<script>
document.writeln(Math.floor(2.7));
</script>
</body>
</html>
<!DOCTYPE html> <html> <body> <script> document.writeln(Math.floor(2.7)); </script> </body> </html>