High order function that can be assigned with any variable or function and can be return
First class citizens function is that function that can return to another function
Example 1:
const maths = {
add: (a, b) => {
return `${a}+${b} = ${a + b}`
},
product: (a, b) => {
return `${a}*${b} = ${a * b}`
},
sum_and_product:(a,b)=>{
return `${maths.add(a,b)} ${maths.product(a,b)}`
}
}
console.log(maths.add(78,4)) //78+4 = 82
console.log(maths.product(78,4)) //78*4 = 312
console.log(maths.sum_and_product(11,12)) //11+12 = 23 11*12 = 132
// here add is an arrow function that has been assigned with maths so add will be higher order function and sum_and_Product is returning function so it will be first class citizen