123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463 |
- //ODD
- /*
- let number = +prompt('Write your number')
- if(number) {
- alert("Your number is " + number)
- }
- else {
- alert('You do not write the number')
- }
- if (number%2==0) {
- alert("It's even number")
- }
- else {
- alert("It's odd number")
- }
- //LEXICS
- let str = prompt("Write some text without number ")
- if (str.indexOf("1","2","3","4","5","6","7","8","9","0")){
- alert("Perfect")
- }
- else {
- alert("You have some mistakes")
- }
- //BOOLEAN
- let sleep = confirm("Are you sleep today?")
- let food = confirm("Are you eat today?")
- alert(food, sleep)
- //IF
- let gender = confirm("Are you man?")
- if(gender) {
- alert("You are man")
- }
- else {
- alert("You are woman")
- }
- //Sizes
- let size = +prompt("Write your size of outerwear?(In USA)") + 2
- if(size){
- alert("Your size in UK: " + size) //United Kingdom
- }
- else {
- alert("Write a number")
- }
- let secondsize = confirm("Обхват вашей талии 63 - 65 см?") && confirm("Обхват ваших бедер 89-92 см?")
- if(secondsize){
- alert("Ваш размер XS")
- }
- else {
- alert("Ваш размер больше XS")
- }
- //TERNARY
- let gender = confirm("Are you woman?") ? alert("woman") : alert("man")
- //PROMPT: OR
- let age = +prompt ('How old are you?') || alert("Write correct number" )
- let year = (2022 - age )
- alert("You were born in " + year)
- //CONFIRM: OR THIS DAY
- let shop = confirm("Shoping?") || alert("You are БЯКА")
- //CONFIRM: IF THIS DAY
- let shop = confirm("Shoping?")
- if(shop){
- alert("Let's go")
- }
- else{
- alert("You are БЯКА")
- }
- //Default: or
- {
- let name = prompt("Write your name") || String(" Ivan")
- let surname = prompt("Write your surname") || String(" Ivanov")
- let patronymic = prompt("Write your patronymic") || String(" Ivanovic")
- alert(name + surname + patronymic)
- }
- //Default: if
- {
- let name = prompt("Write your name")
- let surname = prompt("Write your surname")
- let patronymic = prompt("Write your patronymic")
- if(name){
- }
- else{
- name = String("Ivan")
- }
- if(surname){
- }
- else{
- surname = String(" Ivanov")
- }
- if(patronymic){
- }
- else{
- patronymic = String(" Ivanovic")
- }
- alert(name + surname + patronymic)
- }
- //Login and password
- let login = prompt("Write your login")
- let password = prompt("Write your password")
- if(login===String("admin") && password===String("qwerty")){
- alert("Exactly")
- }
- else{
- alert("You did mistakes in login or password")
- }*/
- /*
- //Currency exchange
- let money = prompt("Choose and write down what currency you need to change \n (\"usd\" , \"eur\" , \"pln\")").toUpperCase()
- let amount = +prompt("How amount of money you want to change?") || alert("write correctly")
- let result , rateBuy , rateSell
- if(money===String("USD") || money===String("EUR") || money===String("PLN")){
-
- }
- else{alert("Update page and write correctly!")}
- if(money===String("USD")){
- let change = confirm("You want to sell or buy") ? "sell" : "buy"
- if(change==="sell"){
- rateSell = 36.9
- result = rateSell * amount
- alert("You will get : " + result + " UAH" )
- }
- else{
- rateBuy = 38.9
- result = rateBuy * amount
- alert("You need : " + result + " UAH" )
- }
- }
- if(money===String("EUR")){
- let change = confirm("You want to sell or buy") ? "sell" : "buy"
- if(change==="sell"){
- rateSell = 36
- result = rateSell * amount
- alert("You will get : " + result + " UAH" )
- }
- else{
- rateBuy = 38
- result = rateBuy * amount
- alert("You need : " + result + " UAH" )
- }
- }
- if(money===String("PLN")){
- let change = confirm("You want to sell or buy") ? "sell" : "buy"
- if(change==="sell"){
- rateSell = 7.57
- result = rateSell * amount
- alert("You will get : " + result + " UAH" )
- }
- else{
- rateBuy = 9.57
- result = rateBuy * amount
- alert("You need : " + result + " UAH" )
- }
- }
- /*
- Second variant
- let secondmoney = prompt("Choose and write down what currency you need to get \n (\"usd\" , \"eur\" , \"uah\")").toUpperCase()
- let rate,result
- let amount = +prompt("How amount of money you want to change?") || alert("write correctly")
- if(money===String("USD")){
- if(secondmoney===String("EUR")){
- rate = 1.02
- }
- else{rate = 36.90}
- }
- if(money===String("EUR")){
- if(secondmoney===String("USD")){
- rate = 0.98
- }
- else{rate = 36.02}
- }
- if(money===String("UAH")){
- if(secondmoney===String("USD")){
- rate = 0.027
- }
- else{rate = 0.028}
- }
- let change = confirm("You want to change") ? "yes" : "not"
- if(change=="yes"){
- result = amount * rate
- }
- alert(result + " : " + secondmoney)
- */
- /*
- //Scissors
- let choise = +prompt("Write number of your power : \n 1- Stone \n 2-Scissors \n 3-Paper ")
- let randomPc = Math.ceil(Math.random() * 3) //Pc choise
- if(choise===1 && randomPc===2){ //STONE
- alert("You win")
- }
- if(choise===1 && randomPc===3){
- alert("You losed")
- }
- if(choise===1 && randomPc===1){
- alert("Draw")
- }
- if(choise===2 && randomPc===3){ //SCISSORS
- alert("You win")
- }
- if(choise===2 && randomPc===1){
- alert("You losed")
- }
- if(choise===2 && randomPc===2){
- alert("Draw")
- }
- if(choise===3 && randomPc===1){ //PAPER
- alert("You win")
- }
- if(choise===3 && randomPc===2){
- alert("You losed")
- }
- if(choise===3 && randomPc===3){
- alert("Draw")
- }
- */
- let exc = prompt("Write name of exercise").toUpperCase()
- if(exc === "NUMBER:ODD"){
- let number = +prompt('Write your number')
- if(number) {
- alert("Your number is " + number)
- }
- else {
- alert('You do not write the number')
- }
- if (number%2==0) {
- alert("It's even number")
- }
- else {
- alert("It's odd number")
- }
- }
- if(exc === "STRING:LEXICS"){
- let str = prompt("Write some text without number ")
- if (str.indexOf("1","2","3","4","5","6","7","8","9","0")){
- alert("Perfect")
- }
- else {
- alert("You have some mistakes")
- }
- }
- if(exc === "BOOLEAN"){
- let sleep = confirm("Are you sleep today?")
- let food = confirm("Are you eat today?")
- alert(food, sleep)
- //IF
- let gender = confirm("Are you man?")
- if(gender) {
- alert("You are man")
- }
- else {
- alert("You are woman")
- }
- }
- if(exc === "BOOLEAN:IF"){
- let gender = confirm("Are you man?")
- if(gender) {
- alert("You are man")
- }
- else {
- alert("You are woman")
- }
- }
- if(exc === "COMPARISON:SIZE"){
- let size = +prompt("Write your size of outerwear?(In USA)") + 2
- if(size){
- alert("Your size in UK: " + size) //United Kingdom
- }
- else {
- alert("Write a number")
- }
- let secondsize = confirm("Обхват вашей талии 63 - 65 см?") && confirm("Обхват ваших бедер 89-92 см?")
- if(secondsize){
- alert("Ваш размер XS")
- }
- else {
- alert("Ваш размер больше XS")
- }
- }
- if(exc === "TERNARY"){
- let gender = confirm("Are you woman?") ? alert("woman") : alert("man")
- }
- if(exc === "PROMPT:OR"){
- let age = +prompt ('How old are you?') || alert("Write correct number" )
- let year = (2022 - age )
- alert("You were born in " + year)
- }
- if(exc === "CONFIRM:OR THIS DAY"){let shop = confirm("Shoping?") || alert("You are БЯКА")}
- if(exc === "CONFIRM:IF THIS DAY"){
- let shop = confirm("Shoping?")
- if(shop){
- alert("Let's go")
- }
- else{
- alert("You are БЯКА")
- }
- }
- if(exc === "DEFAULT:OR"){
- {
- let name = prompt("Write your name") || String(" Ivan")
- let surname = prompt("Write your surname") || String(" Ivanov")
- let patronymic = prompt("Write your patronymic") || String(" Ivanovic")
- alert(name + surname + patronymic)
- }
- }
- if(exc === "DEFAULT:IF"){
- let name = prompt("Write your name")
- let surname = prompt("Write your surname")
- let patronymic = prompt("Write your patronymic")
- if(name){
- }
- else{
- name = String("Ivan")
- }
- if(surname){
- }
- else{
- surname = String(" Ivanov")
- }
- if(patronymic){
- }
- else{
- patronymic = String(" Ivanovic")
- }
- alert(name + surname + patronymic)
- }
- if(exc === "LOGIN AND PASSWORD"){
- let login = prompt("Write your login")
- let password = prompt("Write your password")
- if(login===String("admin") && password===String("qwerty")){
- alert("Exactly")
- }
- else{
- alert("You did mistakes in login or password")
- }
- }
- if(exc === "CURRENCY EXCHANGE"){let money = prompt("Choose and write down what currency you need to change \n (\"usd\" , \"eur\" , \"pln\")").toUpperCase()
- let amount = +prompt("How amount of money you want to change?") || alert("write correctly")
- let result , rateBuy , rateSell
- if(money===String("USD") || money===String("EUR") || money===String("PLN")){
-
- }
- else{alert("Update page and write correctly!")}
- if(money===String("USD")){
- let change = confirm("You want to sell or buy") ? "sell" : "buy"
- if(change==="sell"){
- rateSell = 36.9
- result = rateSell * amount
- alert("You will get : " + result + " UAH" )
- }
- else{
- rateBuy = 38.9
- result = rateBuy * amount
- alert("You need : " + result + " UAH" )
- }
- }
- if(money===String("EUR")){
- let change = confirm("You want to sell or buy") ? "sell" : "buy"
- if(change==="sell"){
- rateSell = 36
- result = rateSell * amount
- alert("You will get : " + result + " UAH" )
- }
- else{
- rateBuy = 38
- result = rateBuy * amount
- alert("You need : " + result + " UAH" )
- }
- }
- if(money===String("PLN")){
- let change = confirm("You want to sell or buy") ? "sell" : "buy"
- if(change==="sell"){
- rateSell = 7.57
- result = rateSell * amount
- alert("You will get : " + result + " UAH" )
- }
- else{
- rateBuy = 9.57
- result = rateBuy * amount
- alert("You need : " + result + " UAH" )
- }
- }
- }
- if(exc === "SCISSORS"){
- let choise = +prompt("Write number of your power : \n 1- Stone \n 2-Scissors \n 3-Paper ")
- let randomPc = Math.ceil(Math.random() * 3) //Pc choise
- if(choise===1 && randomPc===2){ //STONE
- alert("You win")
- }
- if(choise===1 && randomPc===3){
- alert("You losed")
- }
- if(choise===1 && randomPc===1){
- alert("Draw")
- }
- if(choise===2 && randomPc===3){ //SCISSORS
- alert("You win")
- }
- if(choise===2 && randomPc===1){
- alert("You losed")
- }
- if(choise===2 && randomPc===2){
- alert("Draw")
- }
- if(choise===3 && randomPc===1){ //PAPER
- alert("You win")
- }
- if(choise===3 && randomPc===2){
- alert("You losed")
- }
- if(choise===3 && randomPc===3){
- alert("Draw")
- }
- }
|