this context variable this context variable will be bound to the object that is returned from the foo() function of the pseudo constructor. Each function (context) has this associated with this , the value from the context variable depends on the call from the method itself.
For example, calling a function as a property from an object (for example, you are there) will set this variable to this object. When you simply call a function immediately, its this bound to the global object in ES3 and its null in ES5.
There are other methods and keywords that can change the meaning of this . Like new , .bind() , .call() and .apply() . But then again, in your specific fragment here, this will be bound to the object that is stored in that .
jAndy
source share