Last active
October 3, 2017 08:12
-
-
Save oamaok/eaa2e7d44405f9da9d1037385a392aa2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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