How to call back a function which is defined in a variable(I did this)... More than this how to pass variable into that function(which is also defined as variable)
Example: Functionvariable,variable are variables....
function ffunction(Functionvariable,variable){
Functionvariable(variable); //This is actually not working...how to do this...
}
I tried this,
function ffunction(Functionvariable,variable){
eval(Functionvariable + '('+ variable + ')'); //no luck
}
This is worked...
function ffunction(Functionvariable,variable){
eval(Functionvariable)(variable);
}
ffunction(alert, 3)will alert3.var g = function(){alert("called")};function f2(fn,v){fn(v)};f2(g,1)This is the same example as yours but it works