I wrote a program where something like this occurs :
class MyClass
{
att: number = 0
private exec(f: () => void ) {
f()
}
private increment() {
this.att += 1
}
public do(): number {
this.exec(this.increment)
return this.att
}
}
let a = new MyClass()
console.log(a.do()) // prints 0
What is the prettiest way to transfer the "this" with the function in parameters