Created
December 17, 2013 16:15
-
-
Save mrlannigan/8007556 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
function bind (scope, func) { | |
return function () { | |
func.apply(scope, arguments); | |
}; | |
} | |
function A() { | |
this.console.log('hello A, I\'m logging my output via my this because it is bound to the global context'); | |
} | |
function B() { | |
console.log('hello B, here is my this:', this); | |
} | |
A = bind(global, A); | |
B = B.bind({blankObject:true}); | |
// run them | |
A(); | |
B(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment