Back to APIs list![mgruel avatar](https://images.clerk.dev/oauth_github/img_2Ss90I2DHN3cXYlBs1PhitynT6X.jpeg)
Currency API examples & templates
Use these vals as a playground to view and fork Currency API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
![mgruel avatar](https://images.clerk.dev/oauth_github/img_2Ss90I2DHN3cXYlBs1PhitynT6X.jpeg)
exchangeCurrency
@mgruel
Script
Calls https://www.exchangerate-api.com to retrieve the currency exchange rates * for the provided base currency or "eur" if undefined
* @param {string} desired - The desired currency convert to
* @param {number} amount - The amount of target currency
* @param {string} base - The base currency, from which the exchange should be calculated