var Parent = function() {
this.Child = {
childFunction: function() {
this.parentFunction();
}
};
this.parentFunction = function() {
}
};
Now inside this.Child childFunctionthis will refer to the Child object, not the Parent.
So you must use self / to refer to the parent.
var Parent = function() {
var that = this;
this.Child = {
childFunction: function() {
that.parentFunction();
}
};
this.parentFunction = function() {
}
};
Parent.parentFunction().
var Parent = function() {
this.Child = {
childFunction: function() {
Parent.parentFunction();
}
};
this.parentFunction = function() {
}
};