Skip to content

Instantly share code, notes, and snippets.

@tkssharma
Created May 16, 2017 09:22
Show Gist options
  • Save tkssharma/0b93f31c70983e4795a8f541f1aaebe9 to your computer and use it in GitHub Desktop.
Save tkssharma/0b93f31c70983e4795a8f541f1aaebe9 to your computer and use it in GitHub Desktop.
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