First class function in javascript
Higher Order Functions, callback function, returning a function in javascript
I am working as freelancer. I am a experienced full stack web developer. My lovely stack is MERN but I am open for new tech. I love to work with teammates for achieve goals. I love researches to find specific new things.
What is First-class-function?
In javascript, A function can be called a first-class-function, if
It is passing as an argument in another function
It returns as a return value.
It is treated as a variable value.
Examples of First class Function
- Passing as an argument
Here we pass powerTwo in the Powercube function.

- Assigning function as a variable value

- Returning a function

Higher-order-function
A function which passes another function as an argument or returns a function is called a higher-order function.
In the above examples welcomemessege() and Powercube() are higher-order functions.
Callback function
When a function passes as an argument in any function, is called a callback function.
In the above examples, powerTwo() is a callback function.



