Skip to content

Instantly share code, notes, and snippets.

@wiyoe
Created April 17, 2018 06:57
Show Gist options
  • Select an option

  • Save wiyoe/2ab046be6fdc7776373bb4c3c3efa79e to your computer and use it in GitHub Desktop.

Select an option

Save wiyoe/2ab046be6fdc7776373bb4c3c3efa79e to your computer and use it in GitHub Desktop.
The apply, call, and bind methods
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