Skip to content

Instantly share code, notes, and snippets.

@brianium
Created March 13, 2012 14:49
Show Gist options
  • Save brianium/2029237 to your computer and use it in GitHub Desktop.
Save brianium/2029237 to your computer and use it in GitHub Desktop.
closure with bind
var obj = {
method: function(name){
this.name = name;
console.log(this.name);
var inner = function(msg) {
console.log(msg + " " + this.name);
}.bind(this,'hello');
inner();
}
};
obj.method.bind(obj,"Brian")()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment