Trying to pass multiple parameters to a variable function call..
function myFunction(myvar,time){
alert(myvar);
}
t_function = "myFunction";
t_params = "haha,hehe";
window[t_function](t_params);
I basically need to mimic this call
myFunction("haha","hehe");
I can't set a specific amount of params in the variable function call, like
// I will not know how many params a function will need.
window[t_function](t_params1,t_params2,etc);
Any ideas? I'm tempted to use eval.
------ ended up doing this -----
function myFunction(myvar1,myvar2){ alert(myvar1 + " and " + myvar2);
}
t_function = "myFunction";
t_params = [];
t_params[0] = "haha";
t_params[1] = "hehe";
window[t_function].apply(this,t_params);
thanks all, specially to Joseph the Dreamer
var t_params = ['hello','world'];