I have a jQuery function which accepts few arguments based on the argument I should call another jQuery function.
example:
arg0 = "Launch"
arg1 = "menu"
example:
(function($)
{
preRender: function(arg0,arg1)
{
var nextFuncName = arg0+arg1; //launchmenu
nextFuncName() // hope to call the function name framed from the number of arguments
}
})(jQuery);
(function($)
{
launchmenu: function()
{
console.log("Launchmenu called");
}
})(jQuery);
I referred the following link calling a jQuery function named in a variable but I don't want to use eval()
or window object.
Is it possible to use $.proxy
or any other method to achieve this functionality, also is it possible to achieve this using underscore.js?
Any help will be appreciated.