123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- <header>
- CONTENT
- </header>
- <body>
- <button onclick="odd();">odd</button>
- <button onclick="lexics();">lexics</button>
- <button onclick="boolean();">Boolean</button>
- <button onclick="boolean_if();">boolean_if</button>
- <button onclick="sizes();">sizes</button>
- <button onclick="ternary();">Ternary</button>
- <button onclick="prompt_or();">prompt_or</button>
- <button onclick="orThisDays();">orThisDays</button>
- <button onclick="ifThisDays();">ifThisDays</button>
- <button onclick="defaultOr();">defaultOr</button>
- <button onclick="defaultIf();">defaultIf</button>
- <button onclick="loginAndPassword();">loginAndPassword</button>
- <button onclick="currencyExchange();">currencyExchange</button>
- <button onclick="scissors();">scissors</button>
- <button onclick="blackBelt();">blackBelt</button>
- <script>
- function odd() {
- const a = +prompt("Enter a number");
- if (typeof a !== 'number') alert("non correct type");
- if (a % 2) alert("odd");
- else alert("ever");
- }
- function lexics() {
- let phrase = prompt("Enter a phrase").toLowerCase();
- if (phrase.indexOf("xyz") < 0 &&
- phrase.indexOf("234") < 0 &&
- phrase.indexOf("cvb") < 0)
- alert("No fucking sheet...");
- else alert("не хрен ругаться");
- }
- function boolean() {
- var b = confirm("Say Yes or No, please");
- alert(b);
- }
- function boolean_if() {
- var b = confirm("Are You MAN? or WOMEN");
- if (b == true) alert("You are MAN");
- else alert("You are WOMEN")
- }
- function sizes() {
- let sizePants = +prompt("Enter Your size of pants ");
- let hipSize = +prompt("Enter Your hip size sm");
- let sizeSocks = +prompt("Enter Your size of socks");
- usaPants = "-";
- sizeUsa = "-";
- socksUsa = "-";
- if (sizePants == 40) usaPants = "S or 6";
- if (sizePants == 42) usaPants = "M or8";
- if (sizePants == 44) usaPants = "10";
- if (sizePants == 46) usaPants = "L or 12";
- if (sizePants == 48) usaPants = "14";
- if (sizePants == 50) usaPants = "XL or 16";
- if (sizePants == 52) usaPants = "18";
- if (sizePants == 54) usaPants = "XXL or 20";
- if (hipSize >= 89 && hipSize <= 92) sizeUsa = "XXS";
- if (hipSize >= 93 && hipSize <= 96) sizeUsa = "XS";
- if (hipSize >= 97 && hipSize <= 101) sizeUsa = "S";
- if (hipSize >= 102 && hipSize <= 104) sizeUsa = "M";
- if (hipSize >= 105 && hipSize <= 108) sizeUsa = "L";
- if (hipSize >= 109 && hipSize <= 112) sizeUsa = "XL";
- if (hipSize >= 113 && hipSize <= 117) sizeUsa = "XXL";
- if (hipSize >= 118 && hipSize <= 122) sizeUsa = "XXXL";
- if (sizeSocks == 21) socksUsa = "8";
- if (sizeSocks == 23) socksUsa = "9";
- if (sizeSocks == 25) socksUsa = "10";
- if (sizeSocks == 27) socksUsa = "11";
- alert("Your Usa size of pants is:\n" + usaPants + "\n" + 'Your USA hip size is:\n' + sizeUsa + "\n" + "Your USA socks size is:\n" + socksUsa);
- }
- function ternary() {
- confirm("Are You MAN? or WOMEN") ? alert("You are MAN") : alert("You are WOMEN");
- }
- function prompt_or() {
- prompt("Enter Age") ? alert("OK") : alert("Missing age");
- }
- function orThisDays() {
- confirm("ШОПИНГ???") ? alert("OK") : alert("Ты-бяка");
- }
- function ifThisDays() {
- if (confirm("ШОПИНГ???"))
- alert("OK");
- else
- alert("Ты-бяка");
- }
- function defaultOr() {
- let sName = prompt("Enter surname") || "Иванов";
- let name = prompt("Enter name") || "Иван";
- let fName = prompt("Enter father`s name") || "Иванович";
- alert(sName + " " + name + " " + fName);
- }
- function defaultIf() {
- let sName = prompt("Enter surname");
- if (!sName)
- sName = "Иванов";
- let name = prompt("Enter name");
- if (!name)
- name = "Иван";
- let fName = prompt("Enter father`s name");
- if (!fName)
- fName = "Иванович";
- alert(sName + " " + name + " " + fName);
- }
- function loginAndPassword() {
- let rightLogin = "admin";
- let rigthtPass = "qwerty";
- let login = prompt("Enter login");
- let valid = login === rightLogin;
- if (valid) {
- let pass = prompt("Enter password");
- valid = pass === rigthtPass;
- }
- if (valid)
- alert("Congrats!!");
- else
- alert("wrong credentials!!! SUKA");
- }
- function currencyExchange() {
- 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");
- }
- function scissors() {
- let userBid = +prompt("Enter bid 1-3 1=stone 2= scissors 3= paper");
- if (1 >= userBid >= 3) {
- alert(" Non correct bid");
- }
- else {
- let machimeBid = Math.floor(Math.random() * 3 + 1);
- alert(userBid + " " + machimeBid);
- if (userBid == machimeBid) {
- alert("Nobody win");
- }
- else {
- if ((userBid - machimeBid) > 1 ||
- ((machimeBid - userBid) <= 1 &&
- (machimeBid - userBid) >= 0))
- alert("Congrats, You WIN!");
- else
- alert("Sorry, You WoN");
- }
- }
- }
- function blackBelt() {
- let userBid = +prompt("Enter bid 1-3 1=stone 2= scissors 3= paper");
- let machimeBid = Math.floor(Math.random() * 3 + 1);
- alert(userBid + " " + machimeBid);
- userBid == machimeBid ?
- alert("Nobody win") :
- ((userBid - machimeBid) > 1 ||
- ((machimeBid - userBid) <= 1 &&
- (machimeBid - userBid) >= 0)) ?
- alert("Congrats, You WIN!")
- :
- alert("Sorry, You WoN");
- }
- </script>
- </body>
|