There are four meanings that thiscan take, depending on how it was called. Accordingly, it is necessary to monitor what type is thisused, and I can think of thissimple problems in at least 3/4 of them.
Called as a Method
In obj.myFunc(), thisattached to obj.
This can be scary if passed in a callback myFuncbecause it forgets that it was once part of an object and was called autonomous. See What does "var that = this;" mean? in javascript? for the usual workaround.
Called as a standalone function
In plain myFunc(), thisbinds to a global object.
Called as constructor
new myFunc() ( ! , new, , ). , this () .
, new, , , , . , JSLint (IIRC).
( )
myFunc.apply(obj, args), this obj. , , this .