I have classes that instantiate game objects. I want the game objects to get destroyed when the owner object is destroyed through normal means (garbage collection I suppose). This could easily be done by using a destructor, but is this possible in Javascript?
As a workaround, I manually call a cleanup method immediately before clearing the last reference to the object, but that's not as elegant.