Format Currency

Format a number as currency with the appropriate symbol and separators.

Code

Utilities
new Intl.NumberFormat(locale, { style: 'currency', currency }).format(num);

Parameters

The number to format.

Currency code (USD, EUR, GBP, etc.).

Locale for formatting.

Browser·fetch() may be limited by CORS

More JavaScript Snippets