I am trying to do something similar to what Google Analytics is doing. I want to push a function name along with parameters into an array and then execute the function name along with the parameter.
For example:
var _test = _test || [];
_test.push(['setName', 'Todd']);
And execute setName in here:
var widget = function () {
function _private_setName(a) {
console.log(a);
}
return{
setName:_private_setName
};
}();
console.log(_test);
_test contains the function name and parameter, but how can i execute the function?