// const taskName = prompt('Enter task name'); // switch (taskName) { // case 'switch: sizes': const sizeRus = prompt('enter size'); // switch (sizeRus) { // case '40': alert('I 38, GB 8, USA 6'); // break; // case '42': alert('I 40, GB 10, USA 8'); // break; // case '44': alert('I 42, GB 12, USA 10'); // break; // case '46': alert('I 44, GB 14, USA 12'); // break; // case '48': alert('I 46, GB 16, USA 14'); // break; // case '50': alert('I 48, GB 18, USA 16'); // break; // }; // break; // case 'switch: if': let color = prompt("Введите цвет",""); // if (color === "red") { // document.write("
красный
"); // document.write("
черный
"); // } // else if (color === "black") { // document.write("
черный
"); // } // else if (color === "blue") { // document.write("
синий
"); // document.write("
зеленый
"); // } // else if (color === "green") { // document.write("
зеленый
"); // } // else { // document.write("
Я не понял
"); // }; // break; // case 'prompt: or': const age = +(prompt('Your age')); console.log(age); // const yearPresent = 2021; // let ageNew; // if ( age == "" || age === null ) { // ageNew = +prompt('Please writing your age'); // }; console.log(ageNew); // if (ageNew === null || ageNew == "") { // alert('It is not interested for you'); // }; // if (age !== "" || ageNew !== "" || typeof(age) === 'number') { // const yearBirth = yearPresent - ageNew; // const yearBirth1 = yearPresent - age; // alert(` ${yearBirth1} ${yearBirth}`); // }; // break; // case 'confirm: or this days': const shoping = confirm('Shoping?'); console.log(shoping); // shoping || alert(`you are biaka`); // break; // case 'confirm: if this days': const shoping = confirm('Shoping?'); console.log(shoping); // if (shoping === false) { // alert(`you are biaka`); // }; // break; // case 'triple prompt': const surname = prompt('enter surname'); // const userName = prompt('enter name'); // const patronymic = prompt('patronymic'); // alert(`Full name ${surname} ${userName} ${patronymic} `); // break; // case 'default: or': const surname = prompt('enter surname'); // const userName = prompt('enter name'); // const patronymic = prompt('patronymic'); // alert(`Full name ${surname || 'Ivanov'} ${userName || 'Ivanov'} ${patronymic || 'Ivanov'} `); // break; // case 'default: if': let surname = prompt('enter surname'); // let userName = prompt('enter name'); // let patronymic = prompt('patronymic'); // //1) // if (surname === null || surname === "") { // surname = 'Ivanov'; // }; // if (userName === null || userName === ""){ // userName = 'Ivanov'; // }; // if (patronymic === null || patronymic ==="") { // patronymic = 'Ivanov'; // } ; // alert(`Full name ${surname} ${userName} ${patronymic} `); // //2) // if ((surname === null || surname === "") && (userName === null || userName === "") && (patronymic === null || patronymic ==="") ) { // alert('Ivanov Ivanov Ivanov'); // } else if (surname === null || surname === "") { // surname = 'Ivanov'; // alert(`Full name ${surname} ${userName} ${patronymic} `); // } else if (userName === null || userName === ""){ // userName = 'Ivanov'; // alert(`Full name ${surname} ${userName} ${patronymic} `); // } else if (patronymic === null || patronymic ==="") { // patronymic = 'Ivanov'; // alert(`Full name ${surname} ${userName} ${patronymic} `); // } ; // break; // case 'login and password': const login = "admin"; // const password = "qwerty"; // const useLogin = prompt('Enter login'); // let usePassword; // if (login === useLogin) { // usePassword = prompt('Enter password'); // }; // if (login !== useLogin || password !== usePassword) { // alert('Error'); // } else alert('Good!'); // break; // case 'currency calc': const currency = prompt('select currency: usd or eur' ).toLowerCase(); // let monyHr; // switch (currency) { // case 'usd': monyHr = 27; // break; // case 'eur': monyHr = 30; // break; // }; // const hryvnias = prompt('how much UAH'); // alert(`${currency} ${hryvnias / monyHr}`); // break; // case 'currency calc: two rates': const currency = prompt('select currency: usd or eur' ).toLowerCase(); // const question = confirm('Do You want to buy currency?'); // const amount = prompt('Money'); // let monyHr; // switch (currency) { // case 'usd': monyHr = 27; // break; // case 'eur': monyHr = 30; // break; // }; // question ? alert(`${currency} ${amount / monyHr}`) : alert(`hryvnias ${amount * monyHr}`); // break; // case 'currency calc: if': const currency = prompt('select currency: usd or eur' ).toLowerCase(); // const question = confirm('Do You want to buy currency?'); // const amount = prompt('Money'); // let monyHr; // if (currency === 'usd') { // monyHr = 27; // }; // if (currency === 'eur') { // monyHr = 30; // }; // if (question) { // alert(`${currency} ${amount / monyHr}`); // } else alert(`hryvnias ${amount * monyHr}`); // break; // case 'scissors': const things = ['rock', 'scissors', 'paper']; // const userThing = prompt('choose rock or paper or scissors'); // const randomThings = things[ Math.floor(Math.random()*things.length)]; // alert(randomThings); // if ((userThing === 'rock') && (randomThings === 'scissors')) { // alert('you are winner!'); // } else if ((userThing === 'scissors') && (randomThings === 'paper')) { // alert('you are winner!'); // } else if ((userThing === 'paper') && (randomThings === 'rock')) { // alert('you are winner!'); // } else if (randomThings === userThing) { // alert('no one is a winner'); // } else alert('you lose'); // break; // case 'Задание на синий пояс': let ratios = { // usd: 25.6, // eur: 29 // }; // const currency = prompt('select currency: usd or eur' ).toLowerCase(); // const question = confirm('Do You want to buy currency?'); // const amount = prompt('Money'); // const monyHr = ratios[currency]; // question ? alert(`${currency} ${amount / monyHr}`) : alert(`hryvnias ${amount * monyHr}`); // break; // case 'real data': const amountMoney = prompt('Enter Money'); // fetch('https://open.er-api.com/v6/latest/USD').then(res => res.json()) // .then(data => { // console.log(data.rates.UAH) // alert(`UAN ${amountMoney * data.rates.UAH}`) // }); // break; // }; //Task const things = ['rock', 'scissors', 'paper']; const userThing = prompt('choose rock or paper or scissors'); const randomThings = things[ Math.floor(Math.random()*things.length)]; alert(randomThings); ((userThing === 'rock') && (randomThings === 'scissors') && !(alert('you are winner!'))) || ((userThing === 'scissors') && (randomThings === 'paper') && !(alert('you are winner!'))) || ((userThing === 'paper') && (randomThings === 'rock') && !(alert('you are winner!'))) || ((randomThings === userThing) && !(alert('no one is a winner'))) || !(alert('you lose'));