Have a loop, there i have a instance which I will sometime set a method eqvialent to a object which change something in that object. But when I try, it says it is undefined.
var a = [];
a.push(
{
x:0
func: function(){this.x++; console.log(this.x);}
}
);
doFuncInLoop = a[0].func;
doFuncInLoop();
The console log will say this.x i undefined and I understand it not refer to the object, it refer to doFuncInLoop.x, but I want it to change a[0].x