HIGHER ORDER FUNCTIONS
Higher-order functions are functions that operate on other functions by taking them as arguments or returning them.
This concept is closely tied to the idea of functions as first-class citizens in the language. Higher-order functions enable powerful and flexible programming paradigms like functional programming. Here are some common higher-order functions in JavaScript:
app/script.js
1let add = (num1, num2) => num1 + num2;
2function calculate(num1, num2, operation) {
3 return operation(num1, num2);
4}
5console.log(calculate(3, 4, add));
Here , in this code , add is an example of call back function and calculate() is an example of higher order function.