1234567891011121314151617181920212223 |
- let currency = prompt('Укажите валюту:').toLowerCase();
- 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}`);
- }
|