main.js 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. // // first task------------------------------------------------------------------------------------------;
  2. // // var a = 5;
  3. // // var b, c;
  4. // // b = a * 5;
  5. // // b = c = b / 2;
  6. // // Number:age------------------------------------------------------------------------------------------;
  7. // // let yearOfBirth = prompt("Please, type year of your birth", 0000);
  8. // // let currentYear = 2022;
  9. // // let age = currentYear - yearOfBirth;
  10. // // alert(age);
  11. // // Number: temperature----------------------------------------------------------------------------------;
  12. // // let temperatureCelsius = prompt(
  13. // // "Please, enter the temperature in degrees Celsius",
  14. // // 0
  15. // // );
  16. // // let temperatureFahrenheit = temperatureCelsius * 1.8 + 32;
  17. // // alert(temperatureFahrenheit);
  18. // // Number: divide---------------------------------------------------------------------------------------;
  19. // // let num1 = prompt("Enter first number", +0);
  20. // // let num2 = prompt("Enter first number", +0);
  21. // // let result = num1 / num2;
  22. // // alert(Math.floor(result));
  23. // // Number: odd------------------------------------------------------------------------------------------;
  24. // // let Number = prompt("Enter any number", +0);
  25. // // const result2 = Number % 2;
  26. // // if (result === 0) {
  27. // // alert("even number");
  28. // // }
  29. // // if (result === 1) {
  30. // // alert("odd number");
  31. // // }
  32. // // String: greeting-------------------------------------------------------------------------------------;
  33. // // let nameOfUser = prompt("What is your name?", 0);
  34. // // alert(`You are welcome, ${nameOfUser}`);
  35. // // String: lexics---------------------------------------------------------------------------------------;
  36. // // let text = prompt("Enter any text here", []);
  37. // // let message = "All is ok";
  38. // // if (text.includes("fuck")) message = "Think about it";
  39. // // alert(message);
  40. // // Confirm-----------------------------------------------------------------------------------------------;
  41. // // let opinion = confirm("Do you support this man?");
  42. // // alert(opinion);
  43. // // Boolean-----------------------------------------------------------------------------------------------;
  44. // let answer = confirm("Are you eat breed for breakfast?");
  45. // // alert(answer);
  46. // let gender = confirm("Are you a woman?");
  47. // // alert(gender);
  48. // let tall = confirm("Are you taller then 180sm?");
  49. // // alert(tall);
  50. // // Boolean: if--------------------------------------------------------------------------------------------;
  51. // let satiety = confirm("Did you eat anything for breakfast?");
  52. // // if (satiety === true) {
  53. // // alert("it`s good you take care about your health");
  54. // // } else {
  55. // // alert("Oh no, eat something now!!!");
  56. // // }
  57. // let passOnParty = confirm("Are you older than 18?");
  58. // // if (passOnParty === true) {
  59. // // alert("You can passed");
  60. // // } else {
  61. // // alert("You can not passed on party");
  62. // // }
  63. // let canBuy = confirm("Are you older than 18 years?");
  64. // // if (canBuy === true) {
  65. // // alert("You can buy bottle of beer");
  66. // // } else {
  67. // // alert("you are so young for it");
  68. // // }
  69. // // Array: real--------------------------------------------------------------------------------------------;
  70. // let listForShop = ["milk, eggs, meet, water, flour, bread"];
  71. // let ratingList = ["10, 12, 11, 10, 9, 11, 12"];
  72. // let furniture = ["sofa, bed, chair, bedside table"];
  73. // // Array: booleans----------------------------------------------------------------------------------------;
  74. // let booleans = [answer, gender, tall, satiety, passOnParty, canBuy];
  75. // // Array: plus--------------------------------------------------------------------------------------------;
  76. // booleans[2] = booleans[0] + booleans[1];
  77. // alert(booleans);
  78. // // // Array: plus String-------------------------------------------------------------------------------------;
  79. // // booleans["tall"] = booleans["answer"] + booleans["gender"];
  80. // // alert(booleans);
  81. // // Object: real-------------------------------------------------------------------------------------------;
  82. // let myNoteBook = {
  83. // brand: "Lenovo",
  84. // model: "Legion",
  85. // CPU: "AMD Ryzen",
  86. // GPU: "Nvidia GeForce 1650",
  87. // RAM: "16Gb",
  88. // };
  89. // let dreamCar = {
  90. // brand: "Mercedes-Benz",
  91. // model: "Viano",
  92. // length: "187 inch",
  93. // width: "75 inch",
  94. // height: "73.8 inch",
  95. // weight: "4497 lbs",
  96. // };
  97. // let myBook = {
  98. // color: "green",
  99. // weight: "550g",
  100. // length: "35cm",
  101. // width: "24cm",
  102. // };
  103. // alert(Object.entries(myNoteBook));
  104. // alert(Object.entries(dreamCar));
  105. // alert(Object.entries(myBook));
  106. // // Object: change-----------------------------------------------------------------------------------------;
  107. // myNoteBook.RAM = "32 GB";
  108. // myNoteBook.brand = "Asus";
  109. // myNoteBook.model = "Zephirus";
  110. // dreamCar.brand = "Suzuki";
  111. // dreamCar.model = "Vitara";
  112. // alert(Object.entries(myNoteBook));
  113. // alert(Object.entries(dreamCar));
  114. // alert(Object.entries(myBook));
  115. // // Comparison if------------------------------------------------------------------------------------------;
  116. // var age = +prompt("Сколько вам лет?", [""]);
  117. // if (age < 18) {
  118. // alert("школьник");
  119. // } else if (age < 30) {
  120. // alert("молодеж");
  121. // } else if (age < 45) {
  122. // alert("зрелость");
  123. // } else if (age < 60) {
  124. // alert("закат");
  125. // } else if (age > 60) {
  126. // alert("как пенсия?");
  127. // } else {
  128. // alert("то ли киборг, то ли KERNESS");
  129. // }
  130. // // Comparison: sizes--------------------------------------------------------------------------------------;
  131. // let sizeOfDressUA = +prompt(
  132. // "Lets choose the right size for you. Enter your Ukrainian clothing size",
  133. // []
  134. // );
  135. // if (sizeOfDressUA === 38) {
  136. // alert("Your international size is XXS");
  137. // } else if (sizeOfDressUA === 40) {
  138. // alert("Your international size is XS");
  139. // } else if (sizeOfDressUA === 42) {
  140. // alert("Your international size is S");
  141. // } else if (sizeOfDressUA === 44) {
  142. // alert("Your international size is M");
  143. // } else if (sizeOfDressUA === 46) {
  144. // alert("Your international size is L");
  145. // } else if (sizeOfDressUA === 48) {
  146. // alert("Your international size is XL");
  147. // } else if (sizeOfDressUA === 50) {
  148. // alert("Your international size is XXL");
  149. // } else if (sizeOfDressUA === 52) {
  150. // alert("Your international size is 3XL");
  151. // } else {
  152. // alert("We do not know size of your dress");
  153. // }
  154. // // Comparison: object-------------------------------------------------------------------------------------;
  155. // let user = {
  156. // sex: prompt("enter your gender", []),
  157. // bust: +prompt("enter bust measurment in cm", []),
  158. // hips: +prompt("enter hips measurment in cm", []),
  159. // waist: +prompt("enter waist measurment in cm", []),
  160. // };
  161. // if (
  162. // (user.sex === "woman", user.bust === 78, user.hips === 86, user.waist === 68)
  163. // ) {
  164. // alert("Your international size is XXS");
  165. // } else if (
  166. // (user.sex === "woman", user.bust === 82, user.hips === 90, user.waist === 62)
  167. // ) {
  168. // alert("Your international size is XS");
  169. // } else if (
  170. // (user.sex === "woman", user.bust === 86, user.hips === 94, user.waist === 66)
  171. // ) {
  172. // alert("Your international size is S");
  173. // } else if (
  174. // (user.sex === "woman", user.bust === 90, user.hips === 98, user.waist === 70)
  175. // ) {
  176. // alert("Your international size is M");
  177. // } else if (
  178. // (user.sex === "woman", user.bust === 94, user.hips === 102, user.waist === 74)
  179. // ) {
  180. // alert("Your international size is L");
  181. // } else if (
  182. // (user.sex === "woman", user.bust === 98, user.hips === 106, user.waist === 78)
  183. // ) {
  184. // alert("Your international size is XL");
  185. // } else if (
  186. // (user.sex === "woman",
  187. // user.bust === 102,
  188. // user.hips === 110,
  189. // user.waist === 82)
  190. // ) {
  191. // alert("Your international size is XXL");
  192. // } else {
  193. // alert("We could not determine your size, please contact customer service");
  194. // }
  195. // // Ternary------------------------------------------------------------------------------------------------;
  196. // const gender = confirm("Are you a woman?");
  197. // gender === true ? alert("You are a woman") : alert("You are a man");
  198. // // Синий пояс Number: flats-------------------------------------------------------------------------------;
  199. debugger;
  200. let numberOfFloors = prompt("how many floors in your house?", []);
  201. let numberOfFlats = prompt("How many apartments per floor in your house?", []);
  202. let yourApartmentNumber = prompt("Enter? please number of your apartment");
  203. let numberOfApartmentsInTheEntrance = numberOfFloors * numberOfFlats;
  204. let entranceNumber = Math.ceil(
  205. yourApartmentNumber / numberOfApartmentsInTheEntrance
  206. );
  207. let yourFloor = Math.ceil(
  208. (yourApartmentNumber -
  209. numberOfApartmentsInTheEntrance *
  210. Math.floor(yourApartmentNumber / numberOfApartmentsInTheEntrance)) /
  211. numberOfFlats
  212. );
  213. alert(
  214. `Your apartment is located in the ${entranceNumber} entrance, on the ${yourFloor} flor`
  215. );