var MyObj = { someValue = "someRandomValue", newObj = { myFunction = function ( ) { console.log ( this.Parent.someValue ); } // this refers to newObj, this.Parent must refer to MyObj but it isn't // It shows undefined // I'm unable to access the this.Parent } };
user9674579
var MyObj = { someValue : "someRandomValue", newObj : { myFunction : function ( ) { console.log ( this.Parent.someValue ); } // this refers to newObj, this.Parent must refer to MyObj but it isn't // It shows undefined // I'm unable to access the this.Parent } };