-
-
Save bernar83/8a14eb0ceada9df20410000513a80b32 to your computer and use it in GitHub Desktop.
This file contains 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 setName(name) { | |
this.name = name; | |
} | |
var person = {}; | |
const name = setName.bind(person); | |
name('dave'); | |
console.log(person.name); // "dave" | |
const bob = new name('bob'); | |
console.log(person.name); // "dave" | |
console.log(bob.name); // "bob" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment