|
@@ -102,7 +102,7 @@ const euroEURtoBuy = 33.25;
|
|
|
const euroEURforSale = 33.35;
|
|
|
let currency = (prompt("Enter currency", "USD or EUR").toUpperCase());
|
|
|
let forChange = +prompt("Enter number HRN for change");
|
|
|
-let buyOrSale = confirm("To you want to buy?")
|
|
|
+let buyOrSale = confirm("Do you want to buy?")
|
|
|
|
|
|
if (currency === "USD" && buyOrSale === true) {
|
|
|
alert(dollarUSDtoBuy * forChange);
|
|
@@ -120,10 +120,10 @@ if (currency === "USD" && buyOrSale === true) {
|
|
|
|
|
|
let userChoise = prompt("Enter your choise", "rock, paper, scissors");
|
|
|
let computerChoise = Math.random();
|
|
|
-if (computerChoise < 0.33) {
|
|
|
+if (computerChoise <= 0.33) {
|
|
|
computerChoise = "rock"
|
|
|
alert("rock");
|
|
|
-} else if (computerChoise > 0.33 && computerChoise < 0.66) {
|
|
|
+} else if (computerChoise > 0.33 && computerChoise <= 0.66) {
|
|
|
computerChoise = "paper"
|
|
|
alert("paper");
|
|
|
} else {
|
|
@@ -145,4 +145,29 @@ if (userChoise === "rock" && computerChoise === "scissors" ) {
|
|
|
alert("Nobody wins");
|
|
|
} else {
|
|
|
alert("Computer wins");
|
|
|
+}
|
|
|
+
|
|
|
+// ------------------scissors ------------------------------------
|
|
|
+
|
|
|
+let exchangeRates = {
|
|
|
+ dollarUSDtoBuy: 28.25,
|
|
|
+ dollarUSDforSale: 28.37,
|
|
|
+ euroEURtoBuy: 33.25,
|
|
|
+ euroEURforSale: 33.35,
|
|
|
+}
|
|
|
+
|
|
|
+let currency = (prompt("Enter currency", "USD or EUR").toUpperCase());
|
|
|
+let forChange = +prompt("Enter number HRN for change");
|
|
|
+let buyOrSale = confirm("Do you want to buy?")
|
|
|
+
|
|
|
+if (currency === "USD" && buyOrSale === true) {
|
|
|
+ alert(exchangeRates.dollarUSDtoBuy * forChange);
|
|
|
+} else if (currency === "USD" && buyOrSale === false) {
|
|
|
+ alert(exchangeRates.dollarUSDforSale * forChange);
|
|
|
+} else if (currency === "EUR" && buyOrSale === true) {
|
|
|
+ alert(exchangeRates.euroEURtoBuy * forChange);
|
|
|
+} else if (currency === "EUR" && buyOrSale === false) {
|
|
|
+ alert(exchangeRates.euroEURforSale * forChange);
|
|
|
+} else {
|
|
|
+ alert("Wrong data were entered");
|
|
|
}
|