1234567891011121314151617 |
- <head>Currency rate</head>
- <body>
- <script>
- let toCurrency = prompt("Введите приобретаемую валюту").trim().toUpperCase();
- let fromCurrency = prompt("Введите валюту платежа").trim().toUpperCase();
- let currencyAmount = +prompt("Введите сумму платежа").trim().toUpperCase();
- fetch(`https://open.er-api.com/v6/latest/${fromCurrency}`)
- .then(response => response.json())
- .then(data => {
- totalCurrency = currencyAmount * data.rates[toCurrency];
- alert("Total amount: " + totalCurrency + " " + toCurrency);
- });
- </script>
- </body>
|