On this page
  1. Math.floor
  2. Signature & Overview
  3. Notes & Pitfalls
  4. Example

Math.floor

Prev: Math | Up: Math | Next: min
Rel: Math, JSON, Math, BigInt & Date Guide
Ref: MDN Web Docs — Math.floor
Tags: #public #web #javascript #builtins #math #tier/core


Signature & Overview

Math.floor(x)  /* + ceil(), round(), trunc() */

Rounds x downward toward $-\infty$ (trunc() drops the fractional part toward 0).

Notes & Pitfalls

Example

console.assert(Math.floor(2.9) === 2);
console.assert(Math.floor(-2.1) === -3);

Linked from

Related notes