saving . . . saved Functions in JavaScript has been deleted. Functions in JavaScript has been hidden .
Functions in JavaScript
Title
Question
Hello Folks,

Can anyone tell me what are higher-order functions in JavaScript, as I started learning javascript, please let me know your suggestions to bridge the gap.

Thanks in advance!

JavaScript Functions-in-JS 02-03 min 20-30 sec 10-06-21, 11:32 a.m. Steveskok

Answers:

A Higher-order function is a function that takes a function as an input parameter and returns the modified function.
The name of the function which is taking a function as param is HOF.
28-06-21, 3:53 p.m. pravin1389
hey Pravin thank you
28-06-21, 4:02 p.m. Steveskok

Login to add comment


// Higher-order function example (function as an argument)
function operateOnNumber(number, operation) {
  return operation(number);
}

function square(x) {
  return x * x;
}

function double(x) {
  return x * 2;
}

console.log(operateOnNumber(5, square));  // Output: 25
console.log(operateOnNumber(3, double));  // Output: 6

21-11-23, 12:01 p.m. divya@


Log-in to answer to this question.