Free Currency Converter Tool

Currency Converter

Currency Converter

 

Features:

  1. Live Exchange Rates:

    • Fetches real-time currency exchange rates using https://api.exchangerate-api.com.
  2. Dropdowns for Currency Selection:

    • Users can choose both source (From Currency) and target (To Currency) currencies.
  3. Dynamic Calculation:

    • Converts the entered amount based on the selected currencies and displays the exchange rate and converted value.
  4. Error Handling:

    • Ensures the user enters a valid numeric value for the amount and handles invalid inputs gracefully.
  5. Responsive Design:

    • Works seamlessly across desktops, tablets, and mobile devices.
  6. Colorful Styling:

    • Vibrant gradient background and polished design for user engagement.

How It Works:

  1. Initial Setup:

    • On page load, the populateCurrencies function fetches the available currencies and populates the dropdown menus.
  2. User Interaction:

    • Users select the currencies and enter the amount to be converted.
  3. Conversion Logic:

    • When the "Convert" button is clicked, the script:
      • Fetches the exchange rate for the selected source currency.
      • Calculates the converted amount using the formula: Converted Amount=Amount×Exchange Rate\text{Converted Amount} = \text{Amount} \times \text{Exchange Rate}
  4. Result Display:

    • Shows the exchange rate and converted amount dynamically in the results section.
  5. Error Handling:

    • Displays a red error message if the input amount is invalid or missing.

No comments:

Post a Comment