are first order function and first class functions same in javascript..?

798 views Asked by At

what are first class functions and first order functions..? Both are same or not..? Is there any similarities/difference between first order and first class functions in javascript.

I tried to get an answer but didn't get a well-explained one. please help me.. Many sites only explain what is first-class function, not first-order functions. If both are the same, they don't mention it.

1

There are 1 answers

0
Agan On

In JavaScript, a first-order function is a function that is not a higher-order function.

A higher-order function is a function that takes one or more functions as arguments, or returns a function as its result.

First-class functions are functions that can be used like any other value, such as being assigned to a variable, passed as an argument to a function or returned as a result from a function.

In JavaScript, all functions are first-class functions, so a first-order function is also a first-class function.