javascript function as parameter code example
Example 1: javascript function variable arguments
function foo() {
for (var i = 0; i < arguments.length; i++) {
console.log(arguments[i]);
}
}
foo(1,2,3);
Example 2: javascript pass function as parameter
function goToWork(myCallBackFunction) {
myCallBackFunction();
}
function refreshPage() {
alert("I should be refreshing the page");
}
goToWork(refreshPage);
Example 3: how to create a function with parameters in JavaScript
function name(param, param2, param3) {
}
Example 4: js running function as parameter
function FuncOne(param1)
{
}
function FuncTwo(FuncOne, param1)
{
FuncOne(param1);
}