Skip to content

Instantly share code, notes, and snippets.

@dhanush
Last active December 29, 2015 11:38
Show Gist options
  • Save dhanush/17c03a14f77081f9ced9 to your computer and use it in GitHub Desktop.
Save dhanush/17c03a14f77081f9ced9 to your computer and use it in GitHub Desktop.
var add = function(a,b){
console.log(this.value)
return a+b;
};
var methodInvoc = {
value : 0,
myadd : add //reference to global add method
}
methodInvoc.value = methodInvoc.myadd(5,6) //call the method defined on the object
console.log(methodInvoc.value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment