12345678910111213141516171819 |
- <head>
- <h1>Currency</h1>
- </head>
- <body>
- <script>
- let typeCurrency = prompt("Enter currency type").toLowerCase();
- rate = 1.0;
- let isBuy = confirm("Sale?");
- if (typeCurrency === "usd")
- rate = isBuy ? 40 : 43;
- else if (typeCurrency === "eur")
- rate = isBuy ? 39 : 41;
- else if (typeCurrency === "pln")
- rate = isBuy ? 7.5 : 7.8;
- let sumMoney = +prompt("Enter amount");
- alert((sumMoney * rate) + "UAH");
- </script>
- </body>
|