Converts a given amount from USD to any supported currency. Uses real-time exchange rates from the Hexarate API. Results are rounded to 2 decimal places for standard currency format.
The amount to convert
The target currency code (e.g., 'EUR', 'GBP')
The converted amount in the target currency, formatted to 2 decimal places
// Convert 100 USD to EURawait USDto(100, 'EUR')// Returns 85.32 (if rate is 0.8532)// Convert 500 USD to GBPawait USDto(500, 'GBP')// Returns 387.50 (if rate is 0.775) Copy
// Convert 100 USD to EURawait USDto(100, 'EUR')// Returns 85.32 (if rate is 0.8532)// Convert 500 USD to GBPawait USDto(500, 'GBP')// Returns 387.50 (if rate is 0.775)
Converts a given amount from USD to any supported currency. Uses real-time exchange rates from the Hexarate API. Results are rounded to 2 decimal places for standard currency format.