Skip to content

Instantly share code, notes, and snippets.

@maur1th
Created March 10, 2016 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maur1th/49bf2348de8a1ebb13d0 to your computer and use it in GitHub Desktop.
Save maur1th/49bf2348de8a1ebb13d0 to your computer and use it in GitHub Desktop.
const f = () => {
return {
process() {
return Promise.resolve().then(this.other); // Cannot read property 'last' of undefined
return Promise.resolve().then(this.other.bind(this)); // WORKS
return Promise.resolve().then( () => this.other() ); // WORKS
},
other() {
return this.last();
},
last() {
return console.log('hey');
}
};
};
f().process();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment