let currency = prompt('Укажите валюту:').toLowerCase(); let sale = confirm('Укажите тип операции - продажа или покупка?'); let exchangeRate = null; let exchangeRateSymbol = ''; if(currency === 'usd') { exchangeRate = sale ? 39.15 : 38.45; exchangeRateSymbol = '$'; } else if(currency === 'eur') { exchangeRate = sale ? 39.55 : 38.55; exchangeRateSymbol = '€'; } else { alert('Неверно указанная валюта'); } if(currency === 'usd' || currency === 'eur' ) { let quantity = +prompt('Укажите величину в гривне для обмена'); alert(`${quantity} грн по курсу ${sale ? 'продажи' : 'покупки'} в ${currency} = ${(quantity / exchangeRate).toFixed(2)}${exchangeRateSymbol}`); }