let person1 = {
firstName: 'John',
lastName: 'Doe',
name() {
return `${this.firstName} ${this.lastName}`
}
}
console.log('person', person1.name());
let person2 = {
firstName: 'Jane',
lastName: 'Doe'
}
person1.name = person1.name.bind(person1);
person2.name = person1.name.bind(person2);
console.log('person2', person2.name());
() => {
}
function() {
}.bind(this)
Created
October 6, 2017 02:37
-
-
Save ldong/be8ff84169bddbf2e0b10b21566a339b to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment