GarGerry commited on
Commit
5299078
·
verified ·
1 Parent(s): 3687957

Update script.js

Browse files
Files changed (1) hide show
  1. script.js +2 -2
script.js CHANGED
@@ -9,12 +9,12 @@ async function convertCurrency() {
9
  try {
10
  const response = await fetch(`https://v6.exchangerate-api.com/v6/3ebe2ccf9eeea2aaef280201/latest/${fromCurrency}`);
11
  const data = await response.json();
12
-
13
  if (data.result === "success") {
14
  const rate = data.rates[toCurrency];
15
  const convertedAmount = (amount * rate).toFixed(2);
16
  result.innerHTML = `${amount} ${fromCurrency} = ${convertedAmount} ${toCurrency}`;
17
- convertBtn.style.display = 'none'; // Hide button after conversion
18
  } else {
19
  result.innerText = "Error: Unable to fetch exchange rates.";
20
  }
 
9
  try {
10
  const response = await fetch(`https://v6.exchangerate-api.com/v6/3ebe2ccf9eeea2aaef280201/latest/${fromCurrency}`);
11
  const data = await response.json();
12
+
13
  if (data.result === "success") {
14
  const rate = data.rates[toCurrency];
15
  const convertedAmount = (amount * rate).toFixed(2);
16
  result.innerHTML = `${amount} ${fromCurrency} = ${convertedAmount} ${toCurrency}`;
17
+ convertBtn.style.display = 'none'; // Hide convert button after conversion
18
  } else {
19
  result.innerText = "Error: Unable to fetch exchange rates.";
20
  }