Last active
November 7, 2020 08:16
-
-
Save ranamahmud/01fc5c789cf977a2789057aa04c7fb2d 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
const dog = { | |
name: 'Dog', | |
getName: function () { | |
return this.name; | |
}, | |
bark: function () { | |
console.log(this.name + ". Bark bark ...") | |
} | |
} | |
dog.bark(); | |
// Dog. Bark bark ... | |
const bullDog = { | |
name: 'BullDog' | |
} | |
const bullDogBark = dog.bark.bind(bullDog); | |
bullDogBark(); | |
// BullDog. Bark bark ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment