In a class constructor, this refers to the instance being created. In a class method called as a callback, this becomes undefined or the global object unless the method is bound or called with explicit binding.
In a JavaScript class constructor, this refers to the new instance being created. Properties and methods attached to this become instance members. However, when a class method is passed as a callback (e.g., to setTimeout), it loses its binding and this becomes undefined (in strict mode) or the global object. To fix this, you must bind the method in the constructor or use an arrow function class field. Example: class App { constructor() { this.name = 'App'; } log() { console.log(this.name); } } const app = new App(); setTimeout(app.log, 100); // undefined (context lost).