Perhaps you need to rethink how you're creating a task group. Rather than have a taskGroup object, have a task object. Then your taskGroup member in listItem becomes an array of tasks.
function task(name, number) {
this.name = name;
this.number = number;
}
function listItem(name, number) {
this.name = name;
this.number = number;
//Don't do both of these -- choose which is appropriate
//Create an empty array
this.taskGroup = new Array();
//or Create an array with one task already defined based on this name and number
this.taskGroup = [ new task(name, number) ];
}
Then you may access your taskGroup variable like so:
var item = new listItem('one', 1);
var firstTask = item.taskGroup[0];
taskGroup
like[name, number]
? – Nemoy Mar 15 '12 at 16:41