Is it possible to call a function with a variable. For example this works:
- Code: Select all
var myfunc = function() {
alert("Hello!");
}
function call_function(func) {
func();
}
call_function(myfunc);
But can you do it without defining the function as a variable? Can you just do function myfunc instead of myfunc = function()?