Created
December 15, 2020 14:36
-
-
Save samuelpath/1e70c551bab9f6dd60ae6ed8e1d8755c to your computer and use it in GitHub Desktop.
This binding
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
const person = { | |
name: 'Samuel', | |
talk() { | |
console.log(`Hello, my name is ${this.name}`); | |
} | |
}; | |
function sayMyName(name) { | |
console.log(`My name is ${this.name}`); | |
} | |
sayMyName.bind(person)("john"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment