Created
May 16, 2017 09:22
-
-
Save tkssharma/0b93f31c70983e4795a8f541f1aaebe9 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(fn,obj){ | |
rerurn function(){ | |
return fn.call(obj) | |
} | |
} | |
function foo(){ | |
console.log(this.bar); | |
} | |
var obj = {'bar' : 10}; | |
var obj2 = {'bar2' : 20}; | |
var foo = bind(foo,obj); | |
console.log(foo()); | |
foo.call(obj2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment