12345678910111213141516171819202122 |
- let currency = prompt('Укажите валюту:');
- let exchangeRate = null;
- let exchangeRateSymbol = '';
- switch (currency) {
- case 'usd':
- exchangeRate = 39.15;
- exchangeRateSymbol = '$';
- break;
- case 'eur':
- exchangeRate = 39.55;
- exchangeRateSymbol = '€';
- break;
- default:
- alert('Неверно указанная валюта');
- }
- if(currency === 'usd' || currency === 'eur' ) {
- let quantity = +prompt('Укажите величину в гривне для обмена');
- alert(`${quantity} грн в ${currency} = ${(quantity / exchangeRate).toFixed(2)}${exchangeRateSymbol}`);
- }
|