how to get parent object property in javascript/jQuery -
i've been searching way parent object property in nested object had no luck.
here nested object using:
var obj = { name: 'my name', obj1: { age: 18, name: this.name } };
but gives , undefined
error.
is there way in javascript or jquery achieve it?
you can :
var obj = new obj(); function obj(){ var self = this; self.name = 'my name'; self.obj1 = { age: 18, name: self.name } };
Comments
Post a Comment