The 5 rules for determining 'this' in JavaScript are: Default Binding (global/undefined), Implicit Binding (object context), Explicit Binding (call/apply/bind), 'new' Binding (constructor), and Arrow Function Binding (lexical scoping).
Default Binding: When a function is called standalone, this defaults to the global object (window in browsers, global in Node.js) in non-strict mode, or undefined in strict mode. Example: function show() { console.log(this); } show(); // global object or undefined.
Implicit Binding: When a function is called as a method on an object, this refers to the object the method is called on. Example: const obj = { name: 'Alice', greet() { console.log(this.name); } }; obj.greet(); // 'Alice'.
Explicit Binding: Using call, apply, or bind to directly set this. Example: function greet() { console.log(this.name); } greet.call({ name: 'Bob' }); // 'Bob'.
new Binding: When a function is called with the new keyword, this binds to the newly created object. Example: function Person(name) { this.name = name; } const p = new Person('Charlie'); console.log(p.name); // 'Charlie'.
Arrow Function Binding: Arrow functions do not have their own this; they inherit this from their enclosing lexical scope. Example: const obj = { name: 'Dave', greet: () => { console.log(this.name); } }; obj.greet(); // undefined (inherits from outer scope, likely window/global).