OK. We have three times the Function.prototype.bind function here, whose (simplified) code
function bind(context) {
var fn = this;
return function() {
return fn.apply(context, arguments);
}
}
I will abbreviate in a more functional style with lots of partial application: bindfn(context) -> fncontext.
So what does it do? You have got bind.call(bind, bind) or bindbind(bind). Let's expand this to bindbind. What if we now supplied some arguments to it?
bindbind(bind) (fn) (context)
bindbind(fn) (context)
bindfn(context)
fncontext
Here we are. We can assign this to some variables to make the result clearer:
bindbind = bindbind(bind)
bindfn = bindbindanything(fn) // bindfn
contextbindfn = bindfnanything(context) // fncontext
result = contextbindfnanything(args) // fncontext(args)
thisvalue and is controlled by how the code is written. It is static. In contrast, a function'sthisvalue is dynamic and set completely by how the function is called, it has nothing to do with how the function is declared or intialised. So calling "this" context is inappropriate. Those who do so need to read and understand the specification for the language they are using.thislooks exactly like "context".