es6 callback function with parameter code example
Example 1: callback function js
function greeting(name) {
alert('Hello ' + name);
}
function processUserInput(callback) {
var name = prompt('Please enter your name.');
callback(name);
}
processUserInput(greeting);
Example 2: js running function as parameter
function FuncOne(param1) //example function
{
//Do whatever
}
function FuncTwo(FuncOne, param1) //Function to call FuncOne w/ param
{
FuncOne(param1); //Write it like you would any normal function call
}