The Math method that returns the smallest integer greater than or equal to a number is Math.ceil(). It performs the mathematical ceiling operation: Math.ceil(4.2) returns 5, while Math.ceil(4) remains 4.
The method is easy to confuse with Math.floor(), which moves toward negative infinity, and Math.trunc(), which simply removes the fractional part. For positive values, truncation and flooring often appear identical, but negative numbers expose the difference: Math.ceil(-4.2) returns -4, whereas Math.floor(-4.2) returns -5.
Math.round() follows rounding rules based on the fractional portion and is not a ceiling function. JavaScript also preserves a special result for negative zero in some cases, such as Math.ceil(-0.5), which produces -0. The Math object and its rounding methods have been part of standard JavaScript for decades and are available in browsers and Node.js.
In numerical work, ceiling is useful for calculating required pages, batches, storage blocks, or array segments when any partial unit must count as a whole one.