Format money for display.
Converts with fromMinor, then formats with Intl.NumberFormat, which picks the display decimals for the currency (e.g. none for jpy and isk, three for kwd).
Intl.NumberFormat
jpy
isk
kwd
Amount in the smallest currency unit
Currency code, any case (default: usd)
Locale for formatting (default: en-US)
Formatted currency string
If currency is not a non-empty string
currency
formatMoney(1050) // "$10.50"formatMoney(1000, 'jpy', 'ja-JP') // "¥1,000"formatMoney(5120, 'kwd') // "KWD 5.120" Copy
formatMoney(1050) // "$10.50"formatMoney(1000, 'jpy', 'ja-JP') // "¥1,000"formatMoney(5120, 'kwd') // "KWD 5.120"
Format money for display.
Converts with fromMinor, then formats with
Intl.NumberFormat, which picks the display decimals for the currency (e.g. none forjpyandisk, three forkwd).