Created
April 17, 2018 06:57
-
-
Save wiyoe/2ab046be6fdc7776373bb4c3c3efa79e to your computer and use it in GitHub Desktop.
The apply, call, and bind methods
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
| var user = { | |
| name: "Rahul Mhatre", | |
| whatIsYourName: function() { | |
| console.log(this.name); | |
| } | |
| }; | |
| user.whatIsYourName(); // Output: "Rahul Mhatre", | |
| var user2 = { | |
| name: "Neha Sampat" | |
| }; | |
| user.whatIsYourName.call(user2); // Output: "Neha Sampat" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment