Math.floor()
AD · 728×90
Google AdSense / Яндекс.Директ
Math
Math.floor()
Returns the largest integer less than or equal to a given number (rounds down)
→ numberPHP: floor()ES1+
xnumber
Number to round down
Math.floor(x)
RESULT
— click Run or press Ctrl+Enter —
Parameter Reference
ParameterTypeStatusDescription
xnumberrequiredNumber to round down
About

Math.floor() always rounds toward negative infinity — the largest integer <= input. Widely used for generating random integers, computing page numbers, and working with pixel coordinates. Math.floor(-4.1) = -5, not -4.

Browser Support

Available since ES1 (1997). Behavior is fully standardized and identical across all browsers and Node.js.

Tips & Gotchas