Differences in Strict mode vs. Non-strict mode
In the global execution context (outside of any function), this refers to the global object, whether in strict mode or not.
In functions where the values are not defined, using this and not using strict. This is the object itself. However when using strict and this where the value of a function has not been set. Instead of the result being the object the result is undefined.
When a function is called as a method of an object, its
this is set to the object the method is called on. The this always refers to and contains the value of the object and it is usually used inside a function.
This keyword is not assigned a value until an object invokes the function where this is defined. The value This is assigned is based only on the object that invokes the this Function. this has the value of the invoking object in most circumstances. However, there are a few scenarios where this does not have the value of the invoking object. I touch on those scenarios later.
Sources on This