The numeric value to format as currency
Optionaloptions: Formatting options object or currency code string (for backward compatibility)
Optionalcurrency?: stringCurrency code (e.g., 'USD', 'EUR', 'SEK')
Optionallocale?: stringLocale string for regional formatting (e.g., 'en-US', 'sv-SE')
OptionalmaximumFractionDigits?: numberMaximum decimal places to show
OptionalminimumFractionDigits?: numberMinimum decimal places to show
Optionallocale: stringOptional locale for backward compatibility with string options
Formatted currency string with symbol and separators
// Object-style options (recommended)
formatCurrency(1234.56) // "$1,235" (default: USD, 0 decimals)
formatCurrency(1234.56, { currency: 'EUR' }) // "€1,235"
formatCurrency(1234.56, {
currency: 'USD',
minimumFractionDigits: 2,
maximumFractionDigits: 2
}) // "$1,234.56"
// Legacy string-style options (backward compatible)
formatCurrency(1234.56, 'SEK', 'sv-SE') // "1 235 kr"
formatCurrency(50000, 'USD') // "$50,000"
Formats a number as currency with proper thousands separators
Provides flexible currency formatting with support for different locales and currencies. Handles both object-style and legacy string-style parameters for backward compatibility.