A function is a block of code which will be executed by an event or by a call to the function.

Named Functions

A named function can be called by name.

The caller is the JavaScript code which runs the named function.

The named function is a block containing one or more lines of JavaScript code. When the function is called the block of code executes.

The code made take various actions.

The code may return a value.

See JavaScript Functions.

Anonymous Functions

Anonymous functions have no name.

In programming language theory, an anonymous function (also function constant or function literal) is a function (or a subroutine) defined, and possibly called, without being bound to an identifier. Anonymous functions are convenient to pass as an argument to a higher-order function and are ubiquitous in languages with first-class functions such as Haskell. Anonymous functions are a form of nested function, in that they allow access to the variable in the scope of the containing function (non-local variables). Unlike named nested functions, they cannot berecursive without the assistance of a fixpoint operator (also known as an anonymous fixpoint or anonymous recursion).


See also: