I know you can change the context of this
by using apply
and etc.
But why can't you do this?
this = 5; // invalid left-hand side in assignment
It's not much different from this:
function Foo() {
console.log(this.valueOf());
}
Foo.apply(5);
What is the difference between using apply
and this = 5
? Doesn't apply just locally redefine what this
is for whatever function is being called?