tocurrency()
[JS] 로케일 통화로 숫자 포매팅 / 천 단위마다 콤마 추가하기
[JS] 로케일 통화로 숫자 포매팅 / 천 단위마다 콤마 추가하기
2024.05.09toCurrency숫자 타입 n 을 인자로 받아 지정한 통화 포맷을 반환하는 toCurrency 함수. Intl.NumberFormat 메서드를 사용하면 국가/통화에 대한 sensitive formatting을 활성화할 수 있다. const toCurrency = (n, currency, LanguageFormat = undefined) => Intl.NumberFormat(LanguageFormat, { style: 'currency', currency, }).format(n);// €123,456.79 | currency: Euro | currencyLangFormat: LocaltoCurrency(123456.789, 'EUR'); // $123,456.79 | currency: ..