|
@@ -183,6 +183,16 @@ switch (currency) {
|
|
|
var uah = prompt("укажите сумму в гривнах")
|
|
|
alert(`вы можете купить ${(uah / rate).toFixed(1)} ${currency}`) || alert(`вы можете продать ${(uah / rate1).toFixed(1)} ${currency}`)
|
|
|
|
|
|
+// var currency = prompt("usd или eur", "").toLowerCase();
|
|
|
+// var buy = confirm("купить валюту ? нажмите отмена если хотите продать валюту.")
|
|
|
+// switch (currency) {
|
|
|
+// case 'usd':
|
|
|
+// buy ? alert(`вы можете купить ${(prompt("укажите сумму в гривнах") / 40).toFixed(1)} ${currency}`) : alert(`вы можете купить ${(prompt("укажите сумму в долларах") * 38).toFixed(1)} грн `)
|
|
|
+// break;
|
|
|
+// case 'eur':
|
|
|
+// buy ? alert(`вы можете купить ${(prompt("укажите сумму в гривнах") / 41).toFixed(1)} ${currency}`) : alert(`вы можете купить ${(prompt("укажите сумму в евро") * 39).toFixed(1)} грн `)
|
|
|
+// }
|
|
|
+
|
|
|
|
|
|
|
|
|
//currency calc: if/////////////////////////////////////////////
|
|
@@ -197,13 +207,24 @@ if (currency === 'usd' || currency === 'eur') {
|
|
|
} else if (currency === 'eur') {
|
|
|
buy ? rate = 41 : rate1 = 39
|
|
|
}
|
|
|
- alert(`вы можете купить ${(uah / rate).toFixed(1)} ${currency}`) || alert(`вы можете продать ${(uah / rate1).toFixed(1)} ${currency}`)
|
|
|
+ alert(`вы можете купить ${(uah / rate).toFixed(1)} ${currency} `) || alert(`вы можете продать ${(uah / rate1).toFixed(1)} ${currency} `)
|
|
|
}
|
|
|
|
|
|
+// var currency = prompt("usd или eur", "").toLowerCase();
|
|
|
+// if (currency === 'usd' || currency === 'eur') {
|
|
|
+// var buy = confirm("купить валюту ? нажмите отмена если хотите продать валюту.")
|
|
|
+// if (currency === 'usd') {
|
|
|
+// buy ? alert(`вы можете купить ${(prompt("укажите сумму в гривнах") / 40).toFixed(1)} ${currency}`) : alert(`вы можете купить ${(prompt("укажите сумму в долларах") * 38).toFixed(1)} грн `)
|
|
|
+// } else if (currency === 'eur') {
|
|
|
+// buy ? alert(`вы можете купить ${(prompt("укажите сумму в гривнах") / 41).toFixed(1)} ${currency}`) : alert(`вы можете купить ${(prompt("укажите сумму в евро") * 39).toFixed(1)} грн `)
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
//scissors/////////////////////////////////////////////////////
|
|
|
let user = +prompt("введите число для старта, где камень - 1 , ножницы - 2 , бумага - 3")
|
|
|
let comp = Math.ceil(Math.random() * 3)
|
|
|
-alert(`комп выбрал число ${comp}`)
|
|
|
+alert(`комп выбрал число ${comp} `)
|
|
|
if (user === 1 && comp > 1 || user === 2 && comp === 3) {
|
|
|
alert("вы победили!")
|
|
|
}
|
|
@@ -223,8 +244,8 @@ let rations = {
|
|
|
eur: 41,
|
|
|
}
|
|
|
let uah = prompt("укажите сумму в гривнах", "")
|
|
|
-currency1 = uah / rations[`${currency}`]
|
|
|
-alert(`вы можете купить ${currency1} ${currency}`)
|
|
|
+currency1 = uah / rations[`${currency} `]
|
|
|
+alert(`вы можете купить ${currency1} ${currency} `)
|
|
|
|
|
|
|
|
|
|
|
@@ -234,7 +255,7 @@ var uah = prompt("укажите сумму в гривнах")
|
|
|
fetch('https://open.er-api.com/v6/latest/' + currency)
|
|
|
.then(res => res.json())
|
|
|
.then(data => {
|
|
|
- alert(`вы можете купить ${(uah / data.rates.UAH).toFixed(1)} ${currency}`)
|
|
|
+ alert(`вы можете купить ${(uah / data.rates.UAH).toFixed(1)} ${currency} `)
|
|
|
})
|
|
|
|
|
|
|
|
@@ -242,7 +263,7 @@ fetch('https://open.er-api.com/v6/latest/' + currency)
|
|
|
////Задание на черный пояс////////////////////////////////////
|
|
|
let user = +prompt("введите число для старта, где камень - 1 , ножницы - 2 , бумага - 3");
|
|
|
let comp = Math.ceil(Math.random() * 3);
|
|
|
-alert(`комп выбрал число ${comp}`);
|
|
|
+alert(`комп выбрал число ${comp} `);
|
|
|
let userWin = user === 1 && comp > 1 || user === 2 && comp === 3;
|
|
|
let compWin = user === 3 && comp < 3 || user === 2 && comp === 1;
|
|
|
let friendshipWin = user === comp && alert("ничья!");
|