Following is the code I am trying :
var varincaller;
function mainfunction(arg)
{
varincaller = arg;
}
function mainfunction2()
{
var obj2 = new anotherclass;
obj2.anotherfunction = function()
{
//How can I get varincaller, here ?
}
}
Can anybody please help ?
Given your code, since
varincalleris defined outside or in the same scope in which.anotherfunctionis defined, we can access it directly: