function MyClass() {
this.name = 'John';
let self = this;
// Используем значение self внутри стрелочной функции
this.sayHello = () => {
console.log('Hello, ' + self.name);
};
}
let obj = new MyClass();
obj.sayHello();