this operator behaves differently than in other languages and is in most cases determined by how a function is called. (Ref: MDN).
This notion is having many subtleties and being quite hard, I highly suggest you to deep dive in the external resources below. Thus, I will provide what I personally have in mind to determine what this is equal to. I have learned this tip from this article written by Yehuda Katz.
functionmyFunc(){...}// After each statement, you find the value of *this* in myFuncmyFunc.call("myString","hello")// "myString" -- first .call parameter value is injected into *this*// In non-strict-modemyFunc("hello")// window -- myFunc() is syntax sugar for myFunc.call(window, "hello")// In strict-modemyFunc("hello")// undefined -- myFunc() is syntax sugar for myFunc.call(undefined, "hello")
varperson={myFunc:function(){...}}person.myFunc.call(person,"test")// person Object -- first call parameter is injected into *this*person.myFunc("test")// person Object -- person.myFunc() is syntax sugar for person.myFunc.call(person, "test")varmyBoundFunc=person.myFunc.bind("hello")// Creates a new function in which we inject "hello" in *this* valueperson.myFunc("test")// person Object -- The bind method has no effect on the original methodmyBoundFunc("test")// "hello" -- myBoundFunc is person.myFunc with "hello" bound to *this*