我在获取以下代码以从原型 A 执行原型 B 中的函数时遇到问题,并且想知道是否有任何简单的解决方案:
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();