Just create the function you want and save it in a variable:
var func = function() { alertMe("Hello") };
func();
You can even create a function to create your own functions if you want to change the line:
function buildIt(message) {
return function() { alertMe(message) };
}
var func1 = buildIt("Hello");
var func2 = buildIt("Pancakes");
func1();
func2();
source
share