vladislavaSim 2 anos atrás
pai
commit
f34091a611
1 arquivos alterados com 3 adições e 5 exclusões
  1. 3 5
      HW3/main.js

+ 3 - 5
HW3/main.js

@@ -226,15 +226,13 @@ switch (task) {
         break;
 
     case 'real data':
-        let currency = prompt('Do you want to get USD or EUR?').toUpperCase()
-        if(currency === 'USD' || currency === 'EUR') {
-            let uah = +prompt('enter UAH to convert');
+        let currency = prompt('Enter the currency name to convert (e.g. USD)').toUpperCase()
+            let uah3 = +prompt('enter UAH to convert');
             fetch('https://open.er-api.com/v6/latest/' + currency)
                 .then(res => res.json())
                 .then(data => {
-                    alert(`${(uah / data.rates.UAH).toFixed(2)} ${currency}`)
+                    alert(`${(uah3 / data.rates.UAH).toFixed(2)} ${currency}`)
                 })
-        }
         break;
 
     case 'задание на черный пояс':