P
Philip WATTS
" " indicates code.
I have created a javascript object by use of a function.
object function
"function myObject(attribute1, attribute2,etc)"
{
"this.attribute1=attribute1"
"this.attribute2=attribute2"
etc
}
I wish to put the object I create into an array, so I create the array
"myObjectArray=new Array()"
Then I say that I wish to fill the aray with objects
"myObjectArray=new(myObject)"
Then I create the instances
"myObjectArray[0]=new myObject(attribute1,attribute2,etc)"
"myObjectArray[1]=new myObject(attribute1,attribute2,etc)"
This all seems to work fine until I try and establish how many objects I
have by looking at the length of my myObjectArray.
"myObjectArray.length" returns as undefined.
What am I doing wrong?
Many thanks
Phil
I have created a javascript object by use of a function.
object function
"function myObject(attribute1, attribute2,etc)"
{
"this.attribute1=attribute1"
"this.attribute2=attribute2"
etc
}
I wish to put the object I create into an array, so I create the array
"myObjectArray=new Array()"
Then I say that I wish to fill the aray with objects
"myObjectArray=new(myObject)"
Then I create the instances
"myObjectArray[0]=new myObject(attribute1,attribute2,etc)"
"myObjectArray[1]=new myObject(attribute1,attribute2,etc)"
This all seems to work fine until I try and establish how many objects I
have by looking at the length of my myObjectArray.
"myObjectArray.length" returns as undefined.
What am I doing wrong?
Many thanks
Phil