Why are functions called First-class Objects?

Functions in JavaScript are First-class Objects because they are treated as any other value in the language.

They can be assigned to variables, they can be properties of an object which are called methods, they can be an item in array, they can be passed as arguments to a function, and they can be returned as values of a function.

The only difference between a function and any other value in JavaScript is that functions can be invoked or called.


October 09, 2022
937