Browse Source

Rewrite some in 15HW

OleksiiL 1 year ago
parent
commit
14292d8cac
1 changed files with 49 additions and 45 deletions
  1. 49 45
      Homework_15/tree_structure.js

+ 49 - 45
Homework_15/tree_structure.js

@@ -100,46 +100,54 @@ console.log(body.subTags[0].subTags[3].attrs.id);
 // };
 
 // object links---------------------------------------------------------------------------------------------;
-// let clientsCar = {
-//   brand: prompt("Enter a brand car"),
-//   model: prompt("Enter a model of car"),
-//   volume: +prompt("choose volume of your future car"),
-//   color: prompt("What color you wish?"),
-//   HP: +prompt("Enter horse power what you need"),
-//   owner: clientCard.name,
-// };
 
-// let clientCard = {
-//   name: prompt("Enter your name, please"),
-//   surname: prompt("Enter your surname, please"),
-//   age: +prompt("Enter your age, please"),
-//   education: prompt(
-//     "enter your educational level (higher education, secondary education, etc."
-//   ),
-//   gender: prompt("choose your gender: man, woman"),
-//   sallery: +prompt("what is your annual income?"),
-//   car: clientsCar.brand,
-//   notebook: noteOfDream.brand,
-// };
+let clientsCar = {
+  brand: prompt("Enter a brand car"),
+  model: prompt("Enter a model of car"),
+  volume: +prompt("choose volume of your future car"),
+  color: prompt("What color you wish?"),
+  HP: +prompt("Enter horse power what you need"),
+};
+
+let clientCard = {
+  name: prompt("Enter your name, please"),
+  surname: prompt("Enter your surname, please"),
+  age: +prompt("Enter your age, please"),
+  education: prompt(
+    "enter your educational level (higher education, secondary education, etc."
+  ),
+  gender: prompt("choose your gender: man, woman"),
+  sallery: +prompt("what is your annual income?"),
+};
+
+let noteOfDream = {
+  brand: prompt("what brand of laptop would you like?"),
+  model: prompt("select laptop model "),
+  CPU: prompt("select the CPU"),
+  GPU: prompt("choose graphics: built-in or discrete "),
+  GPU_memory: +prompt(
+    "if you chose discrete graphics, select the amount of video memory you want "
+  ),
+  display: {
+    width: +prompt("enter width of resolution"),
+    height: +prompt("enter height of resolution"),
+    refresh_rate: prompt("What level of screen refresh is right for you?"),
+  },
+  storage: {
+    type: prompt("SSD or HDD"),
+    volume: +prompt("How many Gb you need?"),
+  },
+};
+
+clientsCar.owner = clientCard.name;
+
+clientCard.car = clientsCar.brand;
+clientCard.notebook = noteOfDream.brand;
+
+console.log(clientsCar);
+console.log(clientCard);
+console.log(noteOfDream);
 
-// let noteOfDream = {
-//   brand: prompt("what brand of laptop would you like?"),
-//   model: prompt("select laptop model "),
-//   CPU: prompt("select the CPU"),
-//   GPU: prompt("choose graphics: built-in or discrete "),
-//   GPU_memory: +prompt(
-//     "if you chose discrete graphics, select the amount of video memory you want "
-//   ),
-//   display: {
-//     width: +prompt("enter width of resolution"),
-//     height: +prompt("enter height of resolution"),
-//     refresh_rate: prompt("What level of screen refresh is right for you?"),
-//   },
-//   storage: {
-//     type: prompt("SSD or HDD"),
-//     volume: +prompt("How many Gb you need?"),
-//   },
-// };
 // imperative array fill 3----------------------------------------------------------------------------------;
 
 // let foodList = [
@@ -189,11 +197,7 @@ console.log(body.subTags[0].subTags[3].attrs.id);
 
 // empty loop-----------------------------------------------------------------------------------------------;
 
-// for (; userSays !== null; ) {
-//   userSays = prompt("Type anything");
-// }
-
-// console.log(userSays);
+while (prompt() === null);
 
 // progression sum------------------------------------------------------------------------------------------;
 
@@ -209,7 +213,7 @@ console.log(body.subTags[0].subTags[3].attrs.id);
 // let str = "";
 
 // for (i = 0; i <= 10; i++) {
-//   str += "" + "#";
+//   str += " " + "#";
 // }
 
 // console.log(str);
@@ -220,7 +224,7 @@ console.log(body.subTags[0].subTags[3].attrs.id);
 // for (j = 0; j <= 9; j++) {
 //   numbers += "\n";
 //   for (i = 0; i <= 9; i++) {
-//     numbers += "" + i;
+//     numbers += i;
 //   }
 // }
 // console.log(numbers);