Skip to content

Instantly share code, notes, and snippets.

@oamaok
Last active October 3, 2017 08:12
Show Gist options
  • Save oamaok/eaa2e7d44405f9da9d1037385a392aa2 to your computer and use it in GitHub Desktop.
Save oamaok/eaa2e7d44405f9da9d1037385a392aa2 to your computer and use it in GitHub Desktop.
function Foo(value) {
this.value = value;
this.bar = function() {
return this.value;
}
this.baz = () => {
return this.value;
}
}
const foo = new Foo('Hello world!');
const bar = foo.bar;
const baz = foo.baz;
// bar: undefined
console.log('bar:', bar());
// baz: Hello world!
console.log('baz:', baz());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment