금액 format

Intl.NumberFormat

언어에 맞는 숫자 서식을 지원하는 객체의 생성자
locale을 지정하지 않고 사용하면 기본 locale 및 기본 옵션 서식을 적용한 문자열 반환
new Intl.NumberFormat([locales[, options]]) Intl.NumberFormat.call(this[, locales[, options]])
TypeScript
복사
예시
const number = 123456.789; console.log(new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR'})).format(number); // "123.456,79 €" // 한국 원화는 보조 통화 단위를 사용하지 않음 console.log(new Intl.NumberFormat('ko-KR', { style: 'currency', currency: 'KRW' }).format(number)); // → ₩123,457
TypeScript
복사