// callback function
function total(sum, a, b){
if(typeof(a) == 'number' && typeof(b) == 'number' ){
return sum(a,b);
}
}
// console.log(total(function(a,b){
// return a+b
// }, 23, 12))
function sum(a,b){
return a+b;
}
function multi(a,b){
return a*b;
}
function calculate(callback, a, b){
callback(a,b);
}
console.log(calculate(sum, 4,4));
// function when called say hello to the name
function greet(name){
console.log('Hello ' + name);
}
function shout(name){
console.log('Go away ' + name);
}
// function taking input and calling the greet function as a callback
function processUserInput(callback){
const myName = 'Moin';
callback(myName);
}
processUserInput(shout);