Math.floor method
The Math.floor method rounds
a number to integers always down.
Syntax
Math.floor(number);
Example
Let's round the number
2.9999 down:
console.log(Math.floor(2.9999));
The code execution result:
2
See also
-
the
Math.ceilmethod
that rounds a number up -
the
Math.roundmethod
that also rounds a number to an integer -
the
toFixedandtoPrecisionmethods
that round a number with a given precision