1r.nu/eventloop
In programming language design, a first-class citizen (also object, entity, or value) in a given programming language is an entity which supports all the operations generally available to other entities. These operations typically include being passed as a parameter, returned from a function, and assigned to a variable.
In JavaScript, functions are first-class objects,
i.e. they are objects and can be manipulated and passed around just like any other object.
Specifically, they are Function objects.
function multiply(x, y) {
return x * y;
}
var multiply = function(x, y) {
return x * y;
};
var multiply = function func_name(x, y) {
return x * y;
};
Function declaration
Function expression
Named function expression
var multiply = new Function("x","y","return x*y")
Function constructor