You are here: irt.org | FAQ | JavaScript | Object | Q568 [ previous next ]
Here is an example of nesting arrays/objects:
<script language="JavaScript"><!-- function myObject(number,string,object) { this.number = number; this.string = string; this.object = object; } var object1 = new myObject(4,'text',null); var object2 = new myObject(3,'a b c',object1); var object3 = new myObject(1,1998,(1,'xyx',object2)); alert(object3.string); // 1998 alert(object3.object.string); // a b c alert(object3.object.object.string); // text alert(object3.object.object.object); // null //--></script>