1.3K
A function that can take another function as a parameter is referred to as a “higher-order function” in various programming languages.
Here is a JavaScript illustration:function acceptFunc(func) { return func(); }
function sayHello() { return "Hello!"; }
console.log(acceptFunc(sayHello)); // Output: "Hello!"
The acceptFunc function in the above example accepts the function func as a parameter.
The sayHello function is passed as an input when calling the acceptFunc function, and this function returns “Hello!” as the output of calling func.