Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q568 Can arrays/objects be nested?

irt.org | Knowledge Base | JavaScript | Object | Q568 [ previous next ]

Q568 Can arrays/objects be nested?

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.