Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Silent

Hello.

I know I can do checks with instanceof, but how can I find out exactly what is my object's parent? I need to pass an entity to a function, that will spawn another entity of the same type as it's parameter.

Thanks in advance.

1 decade ago by Yojimbo

Unfortunately, in JavaScript, nested objects (children) have no knowledge of their parent object. You'll have to create a property for the child object that references the object that's created it during instantiation.

See this Stack Overflow thread:

http://stackoverflow.com/questions/2980763/javascript-objects-get-parent
Page 1 of 1
« first « previous next › last »