Skip to content

Instantly share code, notes, and snippets.

@jitendra19
Last active January 30, 2019 14:06
Show Gist options
  • Save jitendra19/b55f1c1a39fe4b98369fda8481cacf4e to your computer and use it in GitHub Desktop.
Save jitendra19/b55f1c1a39fe4b98369fda8481cacf4e to your computer and use it in GitHub Desktop.
function a(){
console.log(this.abc);
}
Function.prototype.bindMe = function(scope){
return function(args){
this.apply(scope, args);
}.bind(this)
}
Function.prototype.bindbyself = function(scope){
var self = this;
return function(args){
self.apply(scope, args);
}
}
var b = a.bind({abc:'abc'});
b()
var c = a.bindMe({abc:'1234'})
c()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment