Jump to content

How To Add Several Object


Chikwado

Recommended Posts

How to add several object, For example: Is it possible to use object like this:

var preson = {}; person.anotherperson = {}; person.anotherperson.moreperson{};
Then may be if I want to access element from the third curl bracket, then may be I would use:
person.anotherperson.moreperson['first element of the third object container']
Can some one help explain more. Yes, Edit my post
person.anotherperson.moreperson = {};
Edited by Chikwado
Link to comment
Share on other sites

Why not just try that?

 

Also, this is not valid syntax

person.anotherperson.moreperson{};

maybe you meant?

person.anotherperson.moreperson = {};
Link to comment
Share on other sites

Yes,

var person = {}; person.anotherperson = {}; person.anotherperson.moreperson = {};
To access element from third curl bracket:
document.write(person.anotherperson.moreperson['first element from third curl bracket']);
More correction please.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...