If I have a function:
function myfunc(param1, param2, param3) {
// ...
}
and I have a string:
var myCall = "myfunc(1, 'abc', 'true')"
Is there a way to make the function call using the string and include the params? I don't know the number of parameters in advance. I have tried
var func = myCall.substr(0, myCall.indexOf('('));
var args = myCall.substring(myCall.indexOf('(')+1, myCall.length-1);
window[func](args.split(','));
but that just calls the function with an array to the first parameter. How do I split the arguments and pass them in with an unknown number of parameters?