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@


<span style="border-radius: 4px; padding: 0px 2px; background-image: linear-gradient(90deg, rgb(211, 227, 253) 50%, rgba(0, 0, 0, 0) 50%); background-position: 0% 0px; background-size: 200% 100%; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; color: rgb(4, 12, 40); animation: 0.75s cubic-bezier(0.05, 0.7, 0.1, 1) 0.25s 1 normal forwards running highlight; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 16px;">Higher order functions are functions that take one or more functions as arguments, or return a function as their result. </span>
<span style="border-radius: 4px; padding: 0px 2px; background-image: linear-gradient(90deg, rgb(211, 227, 253) 50%, rgba(0, 0, 0, 0) 50%); background-position: 0% 0px; background-size: 200% 100%; background-repeat: no-repeat; background-attachment: initial; background-origin: initial; background-clip: initial; color: rgb(4, 12, 40); animation: 0.75s cubic-bezier(0.05, 0.7, 0.1, 1) 0.25s 1 normal forwards running highlight; font-family: &quot;Google Sans&quot;, Arial, sans-serif; font-size: 16px;">
let addData=(a,b)=>{
return(a+b);
}
let finalResult=addData(10,20);   
console.log(finalResult);      //30
</span>
26-07-25, 11:31 a.m. siya12032008


A Higher-order function is a function that takes a function as an input parameter and returns the modified function
let addData=(a,b)=>{
return(a+b);
}
let finalResult=addData(10,20);   
console.log(finalResult);      //30
</span>

26-07-25, 11:57 a.m. siya12032008


Log-in to answer to this question.