Skip to content

Instantly share code, notes, and snippets.

@scarstens
Created June 21, 2014 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scarstens/afbbbcdb2b8393e470ab to your computer and use it in GitHub Desktop.
Save scarstens/afbbbcdb2b8393e470ab to your computer and use it in GitHub Desktop.
Call javascript function using a javascript string as a parameter
//enable callFunction function
function callFunction(func){
this[func].apply(this, Array.prototype.slice.call(arguments, 2));
}
/* use case, calling many function dynamically
jQuery.each(filterGroups, function(index, value){
if(value.onoff){
if(maybe_debug) console.log(index,':',value);callFishFinderFunction('applyFilter',index);}
});
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment