Movatterモバイル変換


[0]ホーム

URL:


  1. 개발자를 위한 웹 기술
  2. JavaScript
  3. JavaScript 참고서
  4. 표준 내장 객체
  5. Math
  6. Math.ceil()

This page was translated from English by the community.Learn more and join the MDN Web Docs community.

View in EnglishAlways switch to English

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() 정적 메서드는 언제나 올림하여 주어진 숫자보다 크거나 같은 가장 작은 정수를 반환합니다.

시도해 보기

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

브라우저 호환성

같이 보기

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp