http://en.wikipedia.org/wiki/First-class_function
In computer science, a programming language is said to support first-class functions[1] (also called function literals, function types) if it treats functions as first-class objects. Specifically, this means that the language supports
- constructing new functions during the execution of a program
- storing them in data structures
- passing them as arguments to other functions
- and returning them as the values of other functions.
Python
Python creates functions by the def statement or the lambda expression. Although lambda expressions cannot create functions that use statements in their definition as they are confined to be just expressions, they are flexible enough to show that they create first class functions as well as if the more powerful def statement were used
JavaScript
JavaScript supports both first class functions and lexical scope.
http://en.wikipedia.org/wiki/First-class_object
An object is first-class when it[citation needed]:
- can be stored in variables and data structures
- can be passed as a parameter to a subroutine
- can be returned as the result of a subroutine
- can be constructed at runtime
- has intrinsic identity (independent of any given name)