Skip to content

Instantly share code, notes, and snippets.

@SmolinPavel
Created July 28, 2021 15:38
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 SmolinPavel/f24e2cc09081a3082519b4ed838e1a08 to your computer and use it in GitHub Desktop.
Save SmolinPavel/f24e2cc09081a3082519b4ed838e1a08 to your computer and use it in GitHub Desktop.
this.value = 'D';
const object = {
value: 'A',
methodA: () => {
console.log(this.value);
},
methodB: function () {
console.log(this.value);
},
};
const context = {
value: 'B',
};
object.methodA();
object.methodB();
object.methodA.call(context);
object.methodB.call(context);
object.methodA.bind({ value: 'C' }).call(context);
object.methodB.bind({ value: 'E' }).call(context);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment