ivar_n 2 years ago
parent
commit
65fa39e3c2
1 changed files with 62 additions and 11 deletions
  1. 62 11
      js/04/index.js

+ 62 - 11
js/04/index.js

@@ -53,24 +53,75 @@ function htmlTree() {
    console.log(body.children[0].children[3].attrs.id)  
 }
 
-declarativeFields()
+// declarativeFields()
 function declarativeFields() {
-
+    var notebook = {
+        brand: "HP",
+        type:  "440 G4",
+        model: "Y7Z75EA",
+        ram: 4,
+        size: "14",
+        weight: 1.8,
+        resolution: {
+            width: 1920,
+            height: 1080,
+        },
+    };
+    
+    var phone = {
+        brand: "meizu",
+        model: "m2",
+        ram: 2,
+        color: "black",
+    };
+    
+    var person = {
+        name: "Donald",
+        surname: "Trump",
+        married: true,
+    }
 }
 
-htmlTree()
-function htmlTree() {
-
+// tableMult()
+function tableMult() {
+    let str = '<table>'
+    for (let rowIndex=1; rowIndex<10; rowIndex++){
+        str += '<tr>'
+        for (j=1; j<10; j++){
+            str += `<td>${rowIndex*j}</td>`
+        }
+        str += '</tr>'
+    }
+    str += '</table>'
+    document.write(str)
 }
 
-htmlTree()
-function htmlTree() {
-
+// contArr()
+function contArr() {
+    let inputArr = [1,2,3,4,5,6,'qqq',true]
+    let newElement = 0
+    for (let i=0; i<inputArr.length; i++) {
+        newElement += inputArr[i]
+    }
+    inputArr.push(newElement)
+    console.log(inputArr)
 }
 
-htmlTree()
-function htmlTree() {
-
+// tableMultObj()
+function tableMultObj() {
+    let phone = {
+        brand: "meizu",
+        model: "m2",
+        ram: 2,
+        color: "black",
+        uuuuu: true
+    }
+    let str = '<table>\n'
+    for (const [key, value] of Object.entries(phone)) {
+        str += `    \n<tr><td><b>${key}</b></td><td>${value}</td></tr>\n`
+    }
+    str += '</table>'
+    document.write(str)
 }
 
 htmlTree()