Possible Duplicate:
Crockford’s Prototypal inheritance - Issues with nested objects
I'm having a problem getting the following code to execute a function in prototype B from prototype A, and was wondering if there was any easy solution:
var Ob = function () {
test = 'hi';
}
Ob.prototype.A = {
that : this,
root : this,
goB : function () {
var that = this;
console.log('hello');
that.B.wtf();
}
}
Ob.prototype.B = {
that : this,
root : this,
wtf : function () {
var that = this;
console.log(that);
}
}
test = new Ob;
test.A.goB();