I have following code:
var objectParent:{
     child1:{
       test1:function(){},
       test2:function(){}
      },
      child2:{
       demo1:function(){},
       demo2:function(){},
       parent:this  // gives child2
       grandparent: .... // need to reference objectParent here
      }
    }
We can reference object by using this keyword, But what for grand object or i mean parent of parent object?
Now, i am using grandparent:objectParent to reference parent object
Is there other way like this selector to reference parentObject?
Are these my coding is bad,good or better?
If all your objects have a parent property that refers to their parent, then can get the grandparent with object.parent.parent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With