Can I change the context of javascript "this"?
No, it's not possible.
You can call a method with a specified value for this (using method.apply()
/method.call()
) but you cannot re-assign the keyword, this
.
You can't change what this
refers to from inside the function.
However, you can call a function in a specific context - so that this
refers to a specific object - by using call
or apply
.