I am new to JavaScript and am trying to understand the working of the famous this keyword. I have the following code -
class A {
variableA = 1;
function aFunc(){
return function B(){
// Use variableA and variableC here
}
}
}
class C {
variableC=2;
cFunc;
}
function updateC() {
let a = new A();
let c = new C();
c.cFunc = a.aFunc();
c.cFunc();
}
One possible solution is to store A's this in some other variable. Is there a better way to handle this case?