Анатолий Пивоварский 1 year ago
parent
commit
a64e3d5a89
2 changed files with 125 additions and 0 deletions
  1. 13 0
      HW 3/index.html
  2. 112 0
      HW 3/js/script.js

+ 13 - 0
HW 3/index.html

@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+</head>
+<script src="./js/script.js"></script>
+<body>
+    
+</body>
+</html>

+ 112 - 0
HW 3/js/script.js

@@ -0,0 +1,112 @@
+
+ let body = {
+            tagName: `body`,
+ subTags : [
+                {
+                    tagName: `div`,
+          subTags: [
+                        {
+                        tagName:`span`,
+                         text:'Enter a data please:'
+                        },
+                        {
+                        tagName: `br`
+                        },
+                        {
+                        tagName: `input`,
+                        attrs:{type:'text', id:'name'}
+                        },
+                        {
+                        tagName: `input`, 
+                        attrs:{type:'text', id:'surname'}
+                        }, 
+                    ]
+                },
+                {
+                    tagName: `div`,
+                    subTags: [
+                        {
+                            tagName:`bottom`,
+                            attrs:{id:'ok'}, text:`OK`
+                        },
+                        {
+                            tagName:`bottom`,
+                            attrs:{id:'cancel'}, text:`Cancel`
+                        }
+                    ]
+                } 
+            ] 
+            }
+body.subTags[1].subTags[1].text
+body.subTags[0].subTags[3].attrs.id
+                  
+   //declarative fields
+   
+   let notebook = {
+        brand: prompt (`Enter a brand`),
+        type:  prompt('Enter a type'),
+        model: prompt('Enter a model'),
+        ram: +prompt('Enter a ram'),
+        size: prompt('Size'),
+        weight: +prompt('Weight'),
+    resolution: {
+        width: +prompt ('Width'),
+        height: +prompt ('Height'),
+    },
+   };
+   let phone = {
+         brand: prompt('Enter a brand'),
+         model: prompt('Enter a model'),
+         ram: +prompt('Enter a ram'),
+         color: prompt('Enter a color'),
+};
+let person = {
+         name: prompt('Enter a name'),
+         surname: prompt('Enter a surname'),
+         married: confirm(),
+};
+
+    //imperative array fill 
+
+    let element1 = +prompt(`Введите первый елемент`);
+    let element2 = +prompt(`Введите второй елемент`);
+    let element3 = +prompt(`Введите третий елемент`);
+
+    let element = [];
+    element.push (element1,element2,element3);
+    alert(element);
+
+    //while confirm
+
+       let cake01 = ``;
+       while(cake01!=true) {
+         cake01 = confirm(`Будешь кекс`)
+       }
+
+       //array fill
+       let arr0 = [];
+       let add = ``;
+       while(add != null)
+       {
+        add = prompt(`введите даные`),
+        arr0.push(add);
+       }
+
+    //array fill nopush
+
+       let arr01 = [];
+       let j = 0;
+       let add1 = ``;
+       while(add1 != null)
+       {
+        add1 = prompt(`введите данные`),
+        arr01[j] = add1; ++j
+    }
+   //empty loop
+      let block = ``;
+      while(block!= prompt());
+
+    //chess one line
+     
+
+