Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015년 7월.
toFixed() 메서드는 숫자를 고정 소수점 표기법(fixed-point notation)으로 표시합니다.
소수점 뒤에 나타날 자릿수. 0 이상 20 이하의 값을 사용할 수 있으며, 구현체에 따라 더 넓은 범위의 값을 지원할 수도 있습니다. 값을 지정하지 않으면 0을 사용합니다.
고정 소수점 표기법을 사용하여 나타낸 수를 문자열로 바꾼 값.
digits가 너무 작거나 너무 클 때. 값이 0과 100사이의 값이라면 RangeError를 유발하지 않습니다. 구현체에 따라 더 크거나 작은 값을 지원할 수 있습니다.
TypeErrorNumber가 아닌 객체에서 호출한 경우.
toFixed()는 Number 객체를 주어진 digits 만큼의 소수점 이하 자리수를 정확하게 갖는 문자열 표현으로 반환합니다. 소수점 이하가 길면 숫자를 반올림하고, 짧아서 부족할 경우 뒤를 0으로 채울 수 있습니다. 메서드를 호출한 숫자의 크기가 1e+21보다 크다면 Number.prototype.toString()을 호출하여 받은 지수 표기법 결과를 대신 반환합니다.
| ECMAScript® 2027 Language Specification # sec-number.prototype.tofixed |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025년 2월 11일 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.