Put simply, we entered
thismeant “the new object.” On the other hand, we entered
deep_thought, so while we’re executing that method,
thisis not read from the scope chain as other variables are, but instead is reset on a context by context basis.
The paragraph gave a good way to think about it: this changes based on the object that calls the method. It only gets confusing when you start passing around functions and using callbacks, which is most of the power of functional programming.
As an example, here, I was using an anonymous function as a callback in the request() method. But it doesn't work!
jQuery does not provide such a binding facility. The library’s philosophy favors closures over binding and forces users to jump through hoops (that is, manually combine lexical closures and
call, much as other libraries do internally) when they actually need to pass along a piece of code referring to “instance members.”