|
@@ -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 'задание на черный пояс':
|