offline version v3


34 of 264 menu

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.ceil method
    that rounds a number up
  • the Math.round method
    that also rounds a number to an integer
  • the toFixed and toPrecision methods
    that round a number with a given precision
enru