The Math.floor() method returns the value of a number rounded downwards to the nearest integer.
Example
You can try to run the following code to round down numbers −
Live Demo
<html>
<head>
<title>JavaScript Math floor() Method</title>
</head>
<body>
<script>
var value = Math.floor( 2.7 );
document.write("First Test Value : " + value );
var value = Math.floor( 20.9 );
document.write("<br />Second Test Value : " + value );
var value = Math.floor( 15.4 );
document.write("<br />Third Test Value : " + value );
</script>
</body>
</html>Output
First Test Value : 2 Second Test Value : 20 Third Test Value : 15