This page was translated from English by the community.Learn more and join the MDN Web Docs community.
Math.ceil()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015년 7월.
Math.ceil() 정적 메서드는 언제나 올림하여 주어진 숫자보다 크거나 같은 가장 작은 정수를 반환합니다.
In this article
시도해 보기
console.log(Math.ceil(0.95));// Expected output: 1console.log(Math.ceil(4));// Expected output: 4console.log(Math.ceil(7.004));// Expected output: 8console.log(Math.ceil(-7.004));// Expected output: -7구문
js
Math.ceil(x)매개변수
x숫자
반환 값
x보다 크거나 같은 가장 작은 정수를 반환합니다.-Math.floor(-x)와 동일한 값입니다.
설명
ceil()은Math의 정적 메소드이므로, 생성한Math 객체(Math 는 생성자가 아닙니다)의 메서드로 사용하지 않고, 언제나Math.ceil()으로 사용하세요.
예제
>Math.ceil() 사용하기
js
Math.ceil(-Infinity); // -InfinityMath.ceil(-7.004); // -7Math.ceil(-4); // -4Math.ceil(-0.95); // -0Math.ceil(-0); // -0Math.ceil(0); // 0Math.ceil(0.95); // 1Math.ceil(4); // 4Math.ceil(7.004); // 8Math.ceil(Infinity); // Infinity명세서
| Specification |
|---|
| ECMAScript® 2026 Language Specification> # sec-math.ceil> |