Why is ‘this’ undefined inside class method when using promises?

I have a javascript class, and each method returns a Q promise. I want to know why this is undefined in method2 and method3. Is there a more correct way to write this code? function MyClass(opts){ this.options = opts; return this.method1() .then(this.method2) .then(this.method3); } MyClass.prototype.method1 = function(){ // …q stuff… console.log(this.options); // logs "opts" object … Read more