Created
March 13, 2012 14:49
-
-
Save brianium/2029233 to your computer and use it in GitHub Desktop.
bindless closure
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 self = this; | |
var inner = function(msg) { | |
console.log(msg + " " + self.name); | |
}; | |
inner('hello'); | |
} | |
}; | |
obj.method.bind(obj,"Brian")() | |
//Brian | |
//hello Brian |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment