When used outside of any function or object, this refers to the global object. In browsers, this is usually the window object.
Inside a regular function, this depends on how the function is invoked:
- In strict mode, this is undefined.
- In non-strict mode, this refers to the global object.
When a function is called as a method of an object, this refers to the object itself.
Arrow functions do not have their own this value. They inherit the this value from the enclosing function or context.
You can explicitly bind a specific value to this using bind, call, or apply methods.