Marko 2 anni fa
commit
ff16ee035c
1 ha cambiato i file con 62 aggiunte e 0 eliminazioni
  1. 62 0
      file.js

+ 62 - 0
file.js

@@ -0,0 +1,62 @@
+// html tree
+
+let body = {
+    tagName: "body",
+    subTags: [
+        {tagName: 'div',
+            subTags:[
+{tagName:'br'},
+{tagName:'span', text: 'Enter a data please:'},
+{tagName:'input', attrs:{type:'text', id:'name'}},
+{tagName:'input', attrs:{type:'text', id:'surname'}}
+]},
+        
+        {tagName: 'div',
+            subTags:[
+{tagName:'button', text:'OK', attrs:{id:'ok'}},
+{tagName:'button', text:'Cancel', attrs:{id:'cancel'}}
+]}
+            ]
+}
+body.subTags[1].subTags[1].text
+body.subTags[0].subTags[3].attrs.id
+
+// declarative fields
+
+let notebook = {
+    brand: prompt('Enter  brand'),
+    type:  prompt('Enter  type'),
+    model: prompt('Enter  model'),
+    ram: +prompt('Enter  ram'),
+    size: prompt('Size'),
+    weight: +prompt('Weight'),
+    resolution: {
+        width: +prompt ('Width'),
+        height: +prompt ('Height'),
+    },
+};
+
+let phone = {
+    brand: prompt('Enter brand'),
+    model: prompt('Enter model'),
+    ram: +prompt('Enter ram'),
+    color: prompt('Enter color'),
+};
+
+let person = {
+    name: prompt('Enter a name'),
+    surname: prompt('Enter a surname'),
+    married: confirm(),
+}
+
+// object links??
+
+let person1 = {
+name: 'Marko',
+smartphone:{
+    owner:'Marko'}
+,
+leptop:{
+    owner:'Marko'}
+}
+person1.smartphone.owner.leptop.owner == person1.smartphone