Dhananjay Patel Logo
  1. Home
  2. / Blog
  3. / Advance Js Concept
  4. / Lessons
  5. / 7

Higher-Order Functions

A higher-order function is a function that either takes another function as an argument or returns a function as a result.

Example

function multiplyBy(factor) {
return function(number) {
return number * factor;
};
}
const double = multiplyBy(2);
console.log(double(5)); // Output: 10

Explanation: multiplyBy is a higher-order function because it returns another function that multiplies a number by the given factor.

Application: Higher-order functions are widely used in JavaScript for tasks like array manipulation, event handling, and more.