Created
June 29, 2011 19:56
-
-
Save Maciek416/1054769 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 f = function(){ | |
console.log(this.x); | |
}; | |
var o1 = { | |
x: 7, | |
a: f | |
}; | |
o1.a(); | |
var o2 = { | |
x: 666, | |
// bind f to o1 even though it is attached to o2 | |
a: _.bind(f, o1) | |
}; | |
o2.a(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment