Created
March 13, 2012 14:49
-
-
Save brianium/2029237 to your computer and use it in GitHub Desktop.
closure with bind
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
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