I am trying to store function pointers of an object's functions in an array.But it's giving me problems when I want to access another property of the object within the function.Could any one solve this or give me an idea how to work around it?
function O(){
this.name="hello";
this.f=function(){
alert(this.name);//why does "this" refer to the array arr rather than the object?
};
this.arr=[];
this.arr["x"]=this.f;
}
var d=new O();
d.arr["x"]();