I was trying to execute something like this:
class A {
functionA() {
setTimeout(function() {
console.log(this);
}, 1000)
}
}
const a = new A();
a.functionA();
But this always refers to the window object. I know that you could setup something like var a = this, but is there a more elegant way to pass this down from the object to the inner function?
functionA() { setTimeout(console.log, 3000, this);... make a proper use of setTimeout.