Standard built-ins
Math.floor()
Largest integer not greater than the input; rounds toward negative infinity. Converts x to Number; BigInt conversion throws TypeError.
Formal Syntax & Structure
javascript syntaxjavascript
Math.floor(x)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | number | Number input or value coercible to Number. |
Return Value
number
Result of the numerical operation, possibly NaN.
Working Example
Example Snippetjavascript
console.log(Math.floor(-2.1));