1
JavaScriptIntermediate#functions#this
In a normal function 'this' is decided by the call site: the object before the dot, undefined in strict mode standalone calls, the new instance with new, or an explicit value with call/apply/bind. Arrow functions capture 'this' lexically instead.
const obj = {
name: 'A',
regular() { return this.name; },
arrow: () => this?.name,
};
obj.regular(); // 'A'
obj.arrow(); // undefined