Math.floor() method is used to round the number to downwards to nearest integer number. The given argument value will be integer the value will not rounded. If I give 11.9 it will return the 11 as an output.
Syntax:
Example:
Output:
Syntax:
Math.floor()
Example:
<script> var one = Math.floor(10.9); document.writeln('Output of 10.9 is : ' + one + '</br></br>'); var two = Math.floor(5.4); document.writeln('Output of 5.4 is : ' + two + '</br></br>'); var three = Math.floor(-1.8); document.writeln('Output of -18 is : ' + three + '</br></br>'); var four = Math.floor(-.8); document.writeln('Output of -.8 is : ' + four + '</br></br>'); </script>
Output:
Output of 10.9 is : 10 Output of 5.4 is : 5 Output of -18 is : -2 Output of -.8 is : -1