这就是我想要的:
function MyClass() {
this.some = new Array();
this.another = new Array();
}
MyClass.prototype.some_method = function(element) {
// some work with this.some
}
MyClass.prototype.another_method = function() {
this.another.map(function(el) {
this.some_method(el); // error code
});
}
但我得到它的错误:
Uncaught TypeError: Object [object Window] has no method 'empty_cell'
是否可以在匿名函数中调用 MyClass 方法?