DEV Community

Mahin Tazuar
Mahin Tazuar

Posted on

Callback function vs Higher Order Function

A higher-Order function is a very common and advanced concept in javascript. Actually, the function is like a first-class citizen in javascript. because a function can be stored inside a variable and take argument do the logical expression. So we can say, the callback function is which function takes a function an as argument and the argument function is called a callback function. Programmer can be using this callback function where he needed.

const heigherOrderfunction = (nms,callback) => {
   return callback(nms);
}
function callback(x){
return 'player name is'+x;
}
console.log(heigherOrderfunction ("Rose", callback))
Enter fullscreen mode Exit fullscreen mode

Discussion (0)