- Call the function directly and pass in the parameters.
function functionName(param1, param2) {
}
functionName(value1, value2);
- Invoke a function with parameters using the call() method.
function functionName(param1, param2) {
}
functionName.call(null, value1, value2);
- Call the function with the apply() method and pass in the arguments:
function functionName(param1, param2) {
}
functionName.apply(null, [value1, value2]);
- Create a new function using the bind() method and pass in arguments.
function functionName(param1, param2) {
}
var newFunction = functionName.bind(null, value1, value2);
newFunction();
- Passing as a callback function into another function.
function functionName(param1, param2) {
}
function callbackFunction(callback) {
callback(value1, value2);
}
callbackFunction(functionName);