|
@@ -61,27 +61,27 @@ Object.keys(person)
|
|
|
|
|
|
В качестве значений в ассоциативном массиве могут быть любые типы данных, в том числе и другие ассоциативные массивы:
|
|
В качестве значений в ассоциативном массиве могут быть любые типы данных, в том числе и другие ассоциативные массивы:
|
|
```javascript
|
|
```javascript
|
|
-var someTree = {
|
|
|
|
- tag: "table", //html tag
|
|
|
|
- nestedTags: [ //вложенные тэги
|
|
|
|
|
|
+var tree = {
|
|
|
|
+ name: "Ivan",
|
|
|
|
+ fatherName: "Petrovich",
|
|
|
|
+ surname: "Ivanov",
|
|
|
|
+ children: [
|
|
|
|
+ {
|
|
|
|
+ name: "Maria",
|
|
|
|
+ fatherName: "Ivanovna",
|
|
|
|
+ surname: "Ivanova",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: "Petr",
|
|
|
|
+ fatherName: "Ivanovich",
|
|
|
|
+ surname: "Ivanov",
|
|
|
|
+ },
|
|
{
|
|
{
|
|
- tag: "tr",
|
|
|
|
- nestedTags: [
|
|
|
|
- {
|
|
|
|
- tag: "td",
|
|
|
|
- content: "some text",
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- tag: "td",
|
|
|
|
- content: "some text 2",
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
- options:
|
|
|
|
- {
|
|
|
|
- border: 1,
|
|
|
|
- },
|
|
|
|
|
|
+ name: "Nikolay",
|
|
|
|
+ fatherName: "Ivanovich",
|
|
|
|
+ surname: "Ivanov",
|
|
|
|
+ },
|
|
|
|
+ ]
|
|
}
|
|
}
|
|
```
|
|
```
|
|
|
|
|
|
@@ -97,6 +97,10 @@ a.a = a
|
|
|
|
|
|
a.name = "A"
|
|
a.name = "A"
|
|
b.name = "B"
|
|
b.name = "B"
|
|
|
|
+
|
|
|
|
+for (var i=0,child=tree.children[i]; i<tree.children.length; i++,child=tree.children[i]){
|
|
|
|
+ child.father = tree;
|
|
|
|
+}
|
|
```
|
|
```
|
|
|
|
|
|
## `in`
|
|
## `in`
|