Tag: 类的方法

调用方法在callback

我有这个Try类: function Try () { console.log('Start') this.Something( function() { console.log('asd') this.Some() }) } Try.prototype.Something = function (callback) { console.log('hi all') callback() } Try.prototype.Some = function () { console.log('dsa') } 但是当我尝试在callback部分中调用Some方法时,它给了我一个错误,说this.Some is not a function 。 this.Some is not a function 。 问题是什么? 我怎样才能解决这个问题?