Last active
January 30, 2019 14:06
-
-
Save jitendra19/b55f1c1a39fe4b98369fda8481cacf4e to your computer and use it in GitHub Desktop.
This file contains 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 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