📦 Archived documentation: r1 (committed 2026-10-07) View current documentation →

Math.floor()

Math.floor(x) → number

Returns the largest integer less than or equal to x.

Rounds x down to the previous integer. Integers are returned unchanged. For negative values this rounds away from zero; use Math.trunc() to round toward zero.

Arguments

NameTypeRequiredDefaultDescription
x number optional — A number.

Returns

number The largest integer less than or equal to x.

Example

let f = Math.floor(4.8); // 4