[Javascript] non-html object creation

Håkan Magnusson hakan at backbase.com
Fri Apr 16 08:26:14 CDT 2004


Mike Dougherty wrote:
> something like:
> 
> loMainItem.Item0200[1] = new Item0200( loMainItem, *params*)
> 
> function Item0200 (toParent) {
>   this.parent = toParent
>   *etc*
>   }
> 
> 
> This works because javascript is passing an object pointer, which is 
> then assigned to the newly created object property.  Future references 
> to loMainItem.Item0200[1].parent would reference the loMainItem object, 
> correct?

Correct. This kind of chaining is very nice, if you get the structure 
right from the start, since object pointers are way faster than walking 
through an array looking for the right object.


Regards,
H.



More information about the Javascript mailing list