123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- // // first task------------------------------------------------------------------------------------------;
- // // var a = 5;
- // // var b, c;
- // // b = a * 5;
- // // b = c = b / 2;
- // // Number:age------------------------------------------------------------------------------------------;
- // // let yearOfBirth = prompt("Please, type year of your birth", 0000);
- // // let currentYear = 2022;
- // // let age = currentYear - yearOfBirth;
- // // alert(age);
- // // Number: temperature----------------------------------------------------------------------------------;
- // // let temperatureCelsius = prompt(
- // // "Please, enter the temperature in degrees Celsius",
- // // 0
- // // );
- // // let temperatureFahrenheit = temperatureCelsius * 1.8 + 32;
- // // alert(temperatureFahrenheit);
- // // Number: divide---------------------------------------------------------------------------------------;
- // // let num1 = prompt("Enter first number", +0);
- // // let num2 = prompt("Enter first number", +0);
- // // let result = num1 / num2;
- // // alert(Math.floor(result));
- // // Number: odd------------------------------------------------------------------------------------------;
- // // let Number = prompt("Enter any number", +0);
- // // const result2 = Number % 2;
- // // if (result === 0) {
- // // alert("even number");
- // // }
- // // if (result === 1) {
- // // alert("odd number");
- // // }
- // // String: greeting-------------------------------------------------------------------------------------;
- // // let nameOfUser = prompt("What is your name?", 0);
- // // alert(`You are welcome, ${nameOfUser}`);
- // // String: lexics---------------------------------------------------------------------------------------;
- // // let text = prompt("Enter any text here", []);
- // // let message = "All is ok";
- // // if (text.includes("fuck")) message = "Think about it";
- // // alert(message);
- // // Confirm-----------------------------------------------------------------------------------------------;
- // // let opinion = confirm("Do you support this man?");
- // // alert(opinion);
- // // Boolean-----------------------------------------------------------------------------------------------;
- // let answer = confirm("Are you eat breed for breakfast?");
- // // alert(answer);
- // let gender = confirm("Are you a woman?");
- // // alert(gender);
- // let tall = confirm("Are you taller then 180sm?");
- // // alert(tall);
- // // Boolean: if--------------------------------------------------------------------------------------------;
- // let satiety = confirm("Did you eat anything for breakfast?");
- // // if (satiety === true) {
- // // alert("it`s good you take care about your health");
- // // } else {
- // // alert("Oh no, eat something now!!!");
- // // }
- // let passOnParty = confirm("Are you older than 18?");
- // // if (passOnParty === true) {
- // // alert("You can passed");
- // // } else {
- // // alert("You can not passed on party");
- // // }
- // let canBuy = confirm("Are you older than 18 years?");
- // // if (canBuy === true) {
- // // alert("You can buy bottle of beer");
- // // } else {
- // // alert("you are so young for it");
- // // }
- // // Array: real--------------------------------------------------------------------------------------------;
- // let listForShop = ["milk, eggs, meet, water, flour, bread"];
- // let ratingList = ["10, 12, 11, 10, 9, 11, 12"];
- // let furniture = ["sofa, bed, chair, bedside table"];
- // // Array: booleans----------------------------------------------------------------------------------------;
- // let booleans = [answer, gender, tall, satiety, passOnParty, canBuy];
- // // Array: plus--------------------------------------------------------------------------------------------;
- // booleans[2] = booleans[0] + booleans[1];
- // alert(booleans);
- // // // Array: plus String-------------------------------------------------------------------------------------;
- // // booleans["tall"] = booleans["answer"] + booleans["gender"];
- // // alert(booleans);
- // // Object: real-------------------------------------------------------------------------------------------;
- // let myNoteBook = {
- // brand: "Lenovo",
- // model: "Legion",
- // CPU: "AMD Ryzen",
- // GPU: "Nvidia GeForce 1650",
- // RAM: "16Gb",
- // };
- // let dreamCar = {
- // brand: "Mercedes-Benz",
- // model: "Viano",
- // length: "187 inch",
- // width: "75 inch",
- // height: "73.8 inch",
- // weight: "4497 lbs",
- // };
- // let myBook = {
- // color: "green",
- // weight: "550g",
- // length: "35cm",
- // width: "24cm",
- // };
- // alert(Object.entries(myNoteBook));
- // alert(Object.entries(dreamCar));
- // alert(Object.entries(myBook));
- // // Object: change-----------------------------------------------------------------------------------------;
- // myNoteBook.RAM = "32 GB";
- // myNoteBook.brand = "Asus";
- // myNoteBook.model = "Zephirus";
- // dreamCar.brand = "Suzuki";
- // dreamCar.model = "Vitara";
- // alert(Object.entries(myNoteBook));
- // alert(Object.entries(dreamCar));
- // alert(Object.entries(myBook));
- // // Comparison if------------------------------------------------------------------------------------------;
- // var age = +prompt("Сколько вам лет?", [""]);
- // if (age < 18) {
- // alert("школьник");
- // } else if (age < 30) {
- // alert("молодеж");
- // } else if (age < 45) {
- // alert("зрелость");
- // } else if (age < 60) {
- // alert("закат");
- // } else if (age > 60) {
- // alert("как пенсия?");
- // } else {
- // alert("то ли киборг, то ли KERNESS");
- // }
- // // Comparison: sizes--------------------------------------------------------------------------------------;
- // let sizeOfDressUA = +prompt(
- // "Lets choose the right size for you. Enter your Ukrainian clothing size",
- // []
- // );
- // if (sizeOfDressUA === 38) {
- // alert("Your international size is XXS");
- // } else if (sizeOfDressUA === 40) {
- // alert("Your international size is XS");
- // } else if (sizeOfDressUA === 42) {
- // alert("Your international size is S");
- // } else if (sizeOfDressUA === 44) {
- // alert("Your international size is M");
- // } else if (sizeOfDressUA === 46) {
- // alert("Your international size is L");
- // } else if (sizeOfDressUA === 48) {
- // alert("Your international size is XL");
- // } else if (sizeOfDressUA === 50) {
- // alert("Your international size is XXL");
- // } else if (sizeOfDressUA === 52) {
- // alert("Your international size is 3XL");
- // } else {
- // alert("We do not know size of your dress");
- // }
- // // Comparison: object-------------------------------------------------------------------------------------;
- // let user = {
- // sex: prompt("enter your gender", []),
- // bust: +prompt("enter bust measurment in cm", []),
- // hips: +prompt("enter hips measurment in cm", []),
- // waist: +prompt("enter waist measurment in cm", []),
- // };
- // if (
- // (user.sex === "woman", user.bust === 78, user.hips === 86, user.waist === 68)
- // ) {
- // alert("Your international size is XXS");
- // } else if (
- // (user.sex === "woman", user.bust === 82, user.hips === 90, user.waist === 62)
- // ) {
- // alert("Your international size is XS");
- // } else if (
- // (user.sex === "woman", user.bust === 86, user.hips === 94, user.waist === 66)
- // ) {
- // alert("Your international size is S");
- // } else if (
- // (user.sex === "woman", user.bust === 90, user.hips === 98, user.waist === 70)
- // ) {
- // alert("Your international size is M");
- // } else if (
- // (user.sex === "woman", user.bust === 94, user.hips === 102, user.waist === 74)
- // ) {
- // alert("Your international size is L");
- // } else if (
- // (user.sex === "woman", user.bust === 98, user.hips === 106, user.waist === 78)
- // ) {
- // alert("Your international size is XL");
- // } else if (
- // (user.sex === "woman",
- // user.bust === 102,
- // user.hips === 110,
- // user.waist === 82)
- // ) {
- // alert("Your international size is XXL");
- // } else {
- // alert("We could not determine your size, please contact customer service");
- // }
- // // Ternary------------------------------------------------------------------------------------------------;
- // const gender = confirm("Are you a woman?");
- // gender === true ? alert("You are a woman") : alert("You are a man");
- // // Синий пояс Number: flats-------------------------------------------------------------------------------;
- debugger;
- let numberOfFloors = prompt("how many floors in your house?", []);
- let numberOfFlats = prompt("How many apartments per floor in your house?", []);
- let yourApartmentNumber = prompt("Enter? please number of your apartment");
- let numberOfApartmentsInTheEntrance = numberOfFloors * numberOfFlats;
- let entranceNumber = Math.ceil(
- yourApartmentNumber / numberOfApartmentsInTheEntrance
- );
- let yourFloor = Math.ceil(
- (yourApartmentNumber -
- numberOfApartmentsInTheEntrance *
- Math.floor(yourApartmentNumber / numberOfApartmentsInTheEntrance)) /
- numberOfFlats
- );
- alert(
- `Your apartment is located in the ${entranceNumber} entrance, on the ${yourFloor} flor`
- );
|